@flowdesk/core 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/authority-promotion.d.ts +70 -0
  2. package/dist/authority-promotion.d.ts.map +1 -0
  3. package/dist/authority-promotion.js +388 -0
  4. package/dist/authority-promotion.js.map +1 -0
  5. package/dist/chat-control-authority.d.ts +83 -0
  6. package/dist/chat-control-authority.d.ts.map +1 -0
  7. package/dist/chat-control-authority.js +238 -0
  8. package/dist/chat-control-authority.js.map +1 -0
  9. package/dist/chat-hook-authority-probe.d.ts +39 -0
  10. package/dist/chat-hook-authority-probe.d.ts.map +1 -0
  11. package/dist/chat-hook-authority-probe.js +153 -0
  12. package/dist/chat-hook-authority-probe.js.map +1 -0
  13. package/dist/chat-routing.d.ts.map +1 -1
  14. package/dist/chat-routing.js +18 -15
  15. package/dist/chat-routing.js.map +1 -1
  16. package/dist/connector-gateway.d.ts +34 -0
  17. package/dist/connector-gateway.d.ts.map +1 -0
  18. package/dist/connector-gateway.js +147 -0
  19. package/dist/connector-gateway.js.map +1 -0
  20. package/dist/connector-profile.d.ts +41 -0
  21. package/dist/connector-profile.d.ts.map +1 -0
  22. package/dist/connector-profile.js +125 -0
  23. package/dist/connector-profile.js.map +1 -0
  24. package/dist/controlled-conformance-doc-write.d.ts +44 -0
  25. package/dist/controlled-conformance-doc-write.d.ts.map +1 -0
  26. package/dist/controlled-conformance-doc-write.js +142 -0
  27. package/dist/controlled-conformance-doc-write.js.map +1 -0
  28. package/dist/controlled-redacted-audit-export-write.d.ts +45 -0
  29. package/dist/controlled-redacted-audit-export-write.d.ts.map +1 -0
  30. package/dist/controlled-redacted-audit-export-write.js +145 -0
  31. package/dist/controlled-redacted-audit-export-write.js.map +1 -0
  32. package/dist/core-completion-safety-contracts.d.ts +35 -0
  33. package/dist/core-completion-safety-contracts.d.ts.map +1 -0
  34. package/dist/core-completion-safety-contracts.js +98 -0
  35. package/dist/core-completion-safety-contracts.js.map +1 -0
  36. package/dist/dispatch-attempt-manifest.d.ts +59 -0
  37. package/dist/dispatch-attempt-manifest.d.ts.map +1 -0
  38. package/dist/dispatch-attempt-manifest.js +294 -0
  39. package/dist/dispatch-attempt-manifest.js.map +1 -0
  40. package/dist/dispatch-idempotency.d.ts +89 -0
  41. package/dist/dispatch-idempotency.d.ts.map +1 -0
  42. package/dist/dispatch-idempotency.js +275 -0
  43. package/dist/dispatch-idempotency.js.map +1 -0
  44. package/dist/external-auth-policy.d.ts +49 -0
  45. package/dist/external-auth-policy.d.ts.map +1 -0
  46. package/dist/external-auth-policy.js +166 -0
  47. package/dist/external-auth-policy.js.map +1 -0
  48. package/dist/fake-remote-connector-adapter.d.ts +37 -0
  49. package/dist/fake-remote-connector-adapter.d.ts.map +1 -0
  50. package/dist/fake-remote-connector-adapter.js +162 -0
  51. package/dist/fake-remote-connector-adapter.js.map +1 -0
  52. package/dist/fallback-decision.d.ts +29 -0
  53. package/dist/fallback-decision.d.ts.map +1 -0
  54. package/dist/fallback-decision.js +93 -0
  55. package/dist/fallback-decision.js.map +1 -0
  56. package/dist/fallback-regate-plan.d.ts +34 -0
  57. package/dist/fallback-regate-plan.d.ts.map +1 -0
  58. package/dist/fallback-regate-plan.js +122 -0
  59. package/dist/fallback-regate-plan.js.map +1 -0
  60. package/dist/fds1-schema-probe-result.d.ts +37 -0
  61. package/dist/fds1-schema-probe-result.d.ts.map +1 -0
  62. package/dist/fds1-schema-probe-result.js +115 -0
  63. package/dist/fds1-schema-probe-result.js.map +1 -0
  64. package/dist/index.d.ts +25 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +25 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/lane-heartbeat.d.ts +49 -0
  69. package/dist/lane-heartbeat.d.ts.map +1 -0
  70. package/dist/lane-heartbeat.js +149 -0
  71. package/dist/lane-heartbeat.js.map +1 -0
  72. package/dist/lane-lifecycle-record.d.ts +32 -0
  73. package/dist/lane-lifecycle-record.d.ts.map +1 -0
  74. package/dist/lane-lifecycle-record.js +134 -0
  75. package/dist/lane-lifecycle-record.js.map +1 -0
  76. package/dist/lane-stall-projection.d.ts +43 -0
  77. package/dist/lane-stall-projection.d.ts.map +1 -0
  78. package/dist/lane-stall-projection.js +272 -0
  79. package/dist/lane-stall-projection.js.map +1 -0
  80. package/dist/model-availability-cache.d.ts +286 -0
  81. package/dist/model-availability-cache.d.ts.map +1 -0
  82. package/dist/model-availability-cache.js +1109 -0
  83. package/dist/model-availability-cache.js.map +1 -0
  84. package/dist/operational-intelligence.d.ts +38 -0
  85. package/dist/operational-intelligence.d.ts.map +1 -0
  86. package/dist/operational-intelligence.js +107 -0
  87. package/dist/operational-intelligence.js.map +1 -0
  88. package/dist/production-approval-source.d.ts +61 -0
  89. package/dist/production-approval-source.d.ts.map +1 -0
  90. package/dist/production-approval-source.js +226 -0
  91. package/dist/production-approval-source.js.map +1 -0
  92. package/dist/production-enablement.d.ts +92 -1
  93. package/dist/production-enablement.d.ts.map +1 -1
  94. package/dist/production-enablement.js +421 -8
  95. package/dist/production-enablement.js.map +1 -1
  96. package/dist/production-verification.d.ts +31 -0
  97. package/dist/production-verification.d.ts.map +1 -0
  98. package/dist/production-verification.js +126 -0
  99. package/dist/production-verification.js.map +1 -0
  100. package/dist/provider-usage-collector.d.ts +7 -0
  101. package/dist/provider-usage-collector.d.ts.map +1 -1
  102. package/dist/provider-usage-collector.js +64 -10
  103. package/dist/provider-usage-collector.js.map +1 -1
  104. package/dist/release1-contracts.d.ts +8 -2
  105. package/dist/release1-contracts.d.ts.map +1 -1
  106. package/dist/release1-contracts.js +2 -1
  107. package/dist/release1-contracts.js.map +1 -1
  108. package/dist/remote-write-connector-gate.d.ts +91 -0
  109. package/dist/remote-write-connector-gate.d.ts.map +1 -0
  110. package/dist/remote-write-connector-gate.js +291 -0
  111. package/dist/remote-write-connector-gate.js.map +1 -0
  112. package/dist/runtime-lane-productization.d.ts +78 -0
  113. package/dist/runtime-lane-productization.d.ts.map +1 -0
  114. package/dist/runtime-lane-productization.js +270 -0
  115. package/dist/runtime-lane-productization.js.map +1 -0
  116. package/dist/sanitized-auth-capture.d.ts +50 -0
  117. package/dist/sanitized-auth-capture.d.ts.map +1 -0
  118. package/dist/sanitized-auth-capture.js +164 -0
  119. package/dist/sanitized-auth-capture.js.map +1 -0
  120. package/dist/schema-artifacts.d.ts.map +1 -1
  121. package/dist/schema-artifacts.js +37 -6
  122. package/dist/schema-artifacts.js.map +1 -1
  123. package/dist/schema-registry.d.ts.map +1 -1
  124. package/dist/schema-registry.js +21 -0
  125. package/dist/schema-registry.js.map +1 -1
  126. package/dist/session-evidence.d.ts +117 -0
  127. package/dist/session-evidence.d.ts.map +1 -1
  128. package/dist/session-evidence.js +569 -1
  129. package/dist/session-evidence.js.map +1 -1
  130. package/dist/state-paths.d.ts +1 -1
  131. package/dist/state-paths.d.ts.map +1 -1
  132. package/dist/state-paths.js +56 -6
  133. package/dist/state-paths.js.map +1 -1
  134. package/dist/status.d.ts +7 -0
  135. package/dist/status.d.ts.map +1 -1
  136. package/dist/status.js +89 -1
  137. package/dist/status.js.map +1 -1
  138. package/dist/validators.d.ts +1 -0
  139. package/dist/validators.d.ts.map +1 -1
  140. package/dist/validators.js +30 -7
  141. package/dist/validators.js.map +1 -1
  142. package/package.json +1 -1
@@ -0,0 +1,70 @@
1
+ import type { FlowDeskDispatchAttemptPrecallEvaluationV1 } from "./dispatch-attempt-manifest.js";
2
+ import { type FlowDeskFallbackDecisionV1 } from "./fallback-decision.js";
3
+ import type { GuardBoundaryDecisionV1 } from "./guard-boundary.js";
4
+ import { type FlowDeskProductionApprovalSourceV1 } from "./production-approval-source.js";
5
+ import { type FlowDeskTopTierReviewVerdictV1 } from "./release1-contracts.js";
6
+ import { type ValidationResult } from "./validators.js";
7
+ export declare const FLOWDESK_CONTROLLED_EXTERNAL_WRITE_TARGET_KINDS: readonly ["redacted_audit_export", "release_conformance_doc"];
8
+ export type FlowDeskControlledExternalWriteTargetKindV1 = (typeof FLOWDESK_CONTROLLED_EXTERNAL_WRITE_TARGET_KINDS)[number];
9
+ export interface FlowDeskControlledExternalWriteRequestV1 {
10
+ schema_version: "flowdesk.controlled_external_write_request.v1";
11
+ request_id: string;
12
+ workflow_id: string;
13
+ attempt_id: string;
14
+ target_kind: FlowDeskControlledExternalWriteTargetKindV1;
15
+ target_ref: string;
16
+ redaction_policy_ref: string;
17
+ content_hash_ref: string;
18
+ pre_write_audit_ref: string;
19
+ dry_run_ref: string;
20
+ created_at: string;
21
+ external_write_authority_enabled: false;
22
+ dispatch_authority_enabled: false;
23
+ providerCall: false;
24
+ actualLaneLaunch: false;
25
+ runtimeExecution: false;
26
+ }
27
+ export interface FlowDeskAuthorityPromotionResultV1 extends ValidationResult {
28
+ schema_version: "flowdesk.authority_promotion_result.v1";
29
+ workflow_id?: string;
30
+ attempt_id?: string;
31
+ promotion_kind: "managed_dispatch_beta" | "reviewer_typed_verdict_acceptance" | "fallback_reselection_regate" | "external_write";
32
+ state: "managed_dispatch_beta_authority_enabled" | "typed_verdicts_accepted" | "reselection_regate_authority_enabled" | "external_write_authority_enabled" | "blocked";
33
+ accepted_verdict_ids?: string[];
34
+ accepted_perspectives?: string[];
35
+ target_kind?: FlowDeskControlledExternalWriteTargetKindV1;
36
+ target_ref?: string;
37
+ managed_dispatch_beta_authority_enabled: boolean;
38
+ typed_reviewer_verdict_acceptance_enabled: boolean;
39
+ fallback_reselection_regate_authority_enabled: boolean;
40
+ external_write_authority_enabled: boolean;
41
+ dispatch_authority_enabled: false;
42
+ automatic_fallback_authorized: false;
43
+ realOpenCodeDispatch: false;
44
+ providerCall: false;
45
+ actualLaneLaunch: false;
46
+ runtimeExecution: false;
47
+ }
48
+ export declare function promoteFlowDeskManagedDispatchBetaAuthorityV1(input: {
49
+ guardDecision: GuardBoundaryDecisionV1;
50
+ precallEvaluation: FlowDeskDispatchAttemptPrecallEvaluationV1;
51
+ consumedApproval: FlowDeskProductionApprovalSourceV1;
52
+ auditRef: string;
53
+ conformanceRef: string;
54
+ }): FlowDeskAuthorityPromotionResultV1;
55
+ export declare function promoteFlowDeskReviewerTypedVerdictsV1(input: {
56
+ workflowId: string;
57
+ attemptId: string;
58
+ verdicts: readonly FlowDeskTopTierReviewVerdictV1[];
59
+ consumedApproval: FlowDeskProductionApprovalSourceV1;
60
+ }): FlowDeskAuthorityPromotionResultV1;
61
+ export declare function promoteFlowDeskFallbackReselectionRegateV1(input: {
62
+ decision: FlowDeskFallbackDecisionV1;
63
+ consumedApproval: FlowDeskProductionApprovalSourceV1;
64
+ }): FlowDeskAuthorityPromotionResultV1;
65
+ export declare function validateFlowDeskControlledExternalWriteRequestV1(value: unknown): ValidationResult;
66
+ export declare function promoteFlowDeskExternalWriteAuthorityV1(input: {
67
+ request: FlowDeskControlledExternalWriteRequestV1;
68
+ consumedApproval: FlowDeskProductionApprovalSourceV1;
69
+ }): FlowDeskAuthorityPromotionResultV1;
70
+ //# sourceMappingURL=authority-promotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authority-promotion.d.ts","sourceRoot":"","sources":["../src/authority-promotion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,gCAAgC,CAAC;AACjG,OAAO,EACN,KAAK,0BAA0B,EAE/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAEN,KAAK,kCAAkC,EAEvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEN,KAAK,8BAA8B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,gBAAgB,EAMrB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,+CAA+C,+DAGlD,CAAC;AACX,MAAM,MAAM,2CAA2C,GACtD,CAAC,OAAO,+CAA+C,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAA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AAY,EAAE,KAAK,CAAC;IACpB,gBAAgB,EAAE,KAAK,CAAC;IACxB,gBAAgB,EAAE,KAAK,CAAC;CACxB;AAqOD,wBAAgB,6CAA6C,CAAC,KAAK,EAAE;IACpE,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,0CAA0C,CAAC;IAC9D,gBAAgB,EAAE,kCAAkC,CAAC;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACvB,GAAG,kCAAkC,CA8CrC;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACpD,gBAAgB,EAAE,kCAAkC,CAAC;CACrD,GAAG,kCAAkC,CAkErC;AAED,wBAAgB,0CAA0C,CAAC,KAAK,EAAE;IACjE,QAAQ,EAAE,0BAA0B,CAAC;IACrC,gBAAgB,EAAE,kCAAkC,CAAC;CACrD,GAAG,kCAAkC,CAoCrC;AAED,wBAAgB,gDAAgD,CAC/D,KAAK,EAAE,OAAO,GACZ,gBAAgB,CA0ElB;AAED,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,OAAO,EAAE,wCAAwC,CAAC;IAClD,gBAAgB,EAAE,kCAAkC,CAAC;CACrD,GAAG,kCAAkC,CAkCrC"}
@@ -0,0 +1,388 @@
1
+ import { validateFlowDeskFallbackDecisionV1, } from "./fallback-decision.js";
2
+ import { validateFlowDeskProductionApprovalSourceV1, } from "./production-approval-source.js";
3
+ import { FLOWDESK_TOP_TIER_REVIEW_PERSPECTIVES, } from "./release1-contracts.js";
4
+ import { invalid, valid, validateNoForbiddenRawPayloads, validateOpaqueId, validateOpaqueRef, validateTopTierReviewVerdictV1, } from "./validators.js";
5
+ export const FLOWDESK_CONTROLLED_EXTERNAL_WRITE_TARGET_KINDS = [
6
+ "redacted_audit_export",
7
+ "release_conformance_doc",
8
+ ];
9
+ const disabledPromotionAuthority = {
10
+ managed_dispatch_beta_authority_enabled: false,
11
+ typed_reviewer_verdict_acceptance_enabled: false,
12
+ fallback_reselection_regate_authority_enabled: false,
13
+ external_write_authority_enabled: false,
14
+ dispatch_authority_enabled: false,
15
+ automatic_fallback_authorized: false,
16
+ realOpenCodeDispatch: false,
17
+ providerCall: false,
18
+ actualLaneLaunch: false,
19
+ runtimeExecution: false,
20
+ };
21
+ function isRecord(value) {
22
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23
+ }
24
+ function rejectUnknownProperties(value, allowed, label) {
25
+ const unknown = Object.keys(value).filter((key) => !allowed.includes(key));
26
+ return unknown.length === 0
27
+ ? valid()
28
+ : invalid(`${label} unknown properties: ${unknown.join(",")}`);
29
+ }
30
+ function validateTimestamp(value, label) {
31
+ return typeof value === "string" && Number.isFinite(Date.parse(value))
32
+ ? valid()
33
+ : invalid(`${label} must be a parseable timestamp`);
34
+ }
35
+ function validateHashRef(value, label) {
36
+ const ref = validateOpaqueRef(value, label);
37
+ if (!ref.ok)
38
+ return ref;
39
+ return typeof value === "string" && /^(hash-|sha256-)/.test(value)
40
+ ? valid()
41
+ : invalid(`${label} must be a hash-bound opaque ref`);
42
+ }
43
+ function validateForbiddenAuthorityFields(value, allowed, label) {
44
+ const forbidden = [
45
+ "approve_dispatch",
46
+ "guard_approved_dispatch",
47
+ "fallback_authorized",
48
+ "automatic_provider_call",
49
+ "lane_launch_authority_enabled",
50
+ "github_write_authority_enabled",
51
+ "storage_write_authority_enabled",
52
+ "connector_write_authority_enabled",
53
+ ].filter((key) => key in value && !allowed.includes(key));
54
+ return forbidden.length === 0
55
+ ? valid()
56
+ : invalid(`${label} cannot carry authority-smuggling fields: ${forbidden.join(",")}`);
57
+ }
58
+ function validateGuardBoundaryDecisionV1(value) {
59
+ if (!isRecord(value))
60
+ return invalid("guard boundary decision must be an object");
61
+ const errors = [];
62
+ errors.push(...rejectUnknownProperties(value, [
63
+ "status",
64
+ "reason_category",
65
+ "redacted_reason",
66
+ "required_checks",
67
+ "safe_next_actions",
68
+ ], "guard boundary decision").errors);
69
+ if (!["blocked", "eligible", "diagnostic_only"].includes(String(value.status)))
70
+ errors.push("guard boundary status is invalid");
71
+ if (typeof value.reason_category !== "string" || value.reason_category.length === 0)
72
+ errors.push("guard boundary reason_category is required");
73
+ if (typeof value.redacted_reason !== "string" || value.redacted_reason.length === 0)
74
+ errors.push("guard boundary redacted_reason is required");
75
+ if (!Array.isArray(value.required_checks)) {
76
+ errors.push("guard boundary required_checks must be an array");
77
+ }
78
+ else {
79
+ for (const [index, check] of value.required_checks.entries()) {
80
+ if (!isRecord(check)) {
81
+ errors.push(`guard boundary required_checks[${index}] must be an object`);
82
+ continue;
83
+ }
84
+ errors.push(...rejectUnknownProperties(check, ["check", "result", "ref"], `guard boundary required_checks[${index}]`).errors);
85
+ if (typeof check.check !== "string" || check.check.length === 0)
86
+ errors.push(`guard boundary required_checks[${index}].check is invalid`);
87
+ if (!["pass", "fail", "unknown"].includes(String(check.result)))
88
+ errors.push(`guard boundary required_checks[${index}].result is invalid`);
89
+ if (check.ref !== undefined)
90
+ errors.push(...validateOpaqueRef(check.ref, `guard boundary required_checks[${index}].ref`).errors);
91
+ }
92
+ }
93
+ if (!Array.isArray(value.safe_next_actions))
94
+ errors.push("guard boundary safe_next_actions must be an array");
95
+ errors.push(...validateForbiddenAuthorityFields(value, [], "guard boundary decision").errors);
96
+ errors.push(...validateNoForbiddenRawPayloads(value, "guard_boundary_decision").errors);
97
+ return errors.length === 0 ? valid() : invalid(...errors);
98
+ }
99
+ function hasPassedGuardCheck(decision, checkName, ref) {
100
+ return decision.required_checks.some((check) => check.check === checkName && check.result === "pass" && check.ref === ref);
101
+ }
102
+ function validatePrecallEvaluationV1(value) {
103
+ if (!isRecord(value))
104
+ return invalid("precall evaluation must be an object");
105
+ const record = value;
106
+ const errors = [];
107
+ errors.push(...rejectUnknownProperties(record, [
108
+ "schema_version",
109
+ "workflow_id",
110
+ "attempt_id",
111
+ "ok",
112
+ "errors",
113
+ "state",
114
+ "sdk_call_permitted",
115
+ "blocked_labels",
116
+ "dispatch_authority_enabled",
117
+ "realOpenCodeDispatch",
118
+ "actualLaneLaunch",
119
+ "providerCall",
120
+ "runtimeExecution",
121
+ ], "precall evaluation").errors);
122
+ if (record.schema_version !== "flowdesk.dispatch_attempt_precall_evaluation.v1")
123
+ errors.push("precall evaluation schema_version is invalid");
124
+ if (record.workflow_id !== undefined)
125
+ errors.push(...validateOpaqueId(record.workflow_id, "precall workflow_id").errors);
126
+ if (record.attempt_id !== undefined)
127
+ errors.push(...validateOpaqueId(record.attempt_id, "precall attempt_id").errors);
128
+ if (typeof record.ok !== "boolean")
129
+ errors.push("precall ok must be boolean");
130
+ if (!Array.isArray(record.errors))
131
+ errors.push("precall errors must be an array");
132
+ if (record.state !== "sdk_call_permitted" && record.state !== "blocked_before_sdk_call")
133
+ errors.push("precall state is invalid");
134
+ if (typeof record.sdk_call_permitted !== "boolean")
135
+ errors.push("precall sdk_call_permitted must be boolean");
136
+ if (!Array.isArray(record.blocked_labels)) {
137
+ errors.push("precall blocked_labels must be an array");
138
+ }
139
+ else {
140
+ for (const [index, label] of record.blocked_labels.entries())
141
+ errors.push(...validateOpaqueRef(label, `precall blocked_labels[${index}]`).errors);
142
+ }
143
+ if (record.dispatch_authority_enabled !== false ||
144
+ record.realOpenCodeDispatch !== false ||
145
+ record.actualLaneLaunch !== false ||
146
+ record.providerCall !== false ||
147
+ record.runtimeExecution !== false)
148
+ errors.push("precall evaluation cannot enable runtime authority");
149
+ errors.push(...validateForbiddenAuthorityFields(record, [], "precall evaluation").errors);
150
+ errors.push(...validateNoForbiddenRawPayloads(record, "precall_evaluation").errors);
151
+ return errors.length === 0 ? valid() : invalid(...errors);
152
+ }
153
+ function consumedApprovalErrors(approval, workflowId, attemptId, actionType) {
154
+ if (approval === undefined)
155
+ return ["consumed approval is required"];
156
+ const errors = [];
157
+ const result = validateFlowDeskProductionApprovalSourceV1(approval, workflowId);
158
+ errors.push(...result.errors);
159
+ if (approval.action_type !== actionType)
160
+ errors.push("approval action_type mismatch");
161
+ if (approval.workflow_id !== workflowId)
162
+ errors.push("approval workflow_id mismatch");
163
+ if (approval.attempt_id !== attemptId)
164
+ errors.push("approval attempt_id mismatch");
165
+ if (approval.consumed_at === undefined)
166
+ errors.push("approval must be consumed");
167
+ if (approval.consumed_by_attempt_id !== attemptId)
168
+ errors.push("approval consumed_by_attempt_id mismatch");
169
+ if (approval.consumption_audit_ref === undefined)
170
+ errors.push("approval consumption_audit_ref is required");
171
+ if (approval.revoked)
172
+ errors.push("approval is revoked");
173
+ return errors;
174
+ }
175
+ function blockedResult(promotionKind, errors, workflowId, attemptId) {
176
+ return {
177
+ schema_version: "flowdesk.authority_promotion_result.v1",
178
+ workflow_id: workflowId,
179
+ attempt_id: attemptId,
180
+ promotion_kind: promotionKind,
181
+ state: "blocked",
182
+ ok: false,
183
+ errors,
184
+ ...disabledPromotionAuthority,
185
+ };
186
+ }
187
+ export function promoteFlowDeskManagedDispatchBetaAuthorityV1(input) {
188
+ const workflowId = input.precallEvaluation.workflow_id;
189
+ const attemptId = input.precallEvaluation.attempt_id;
190
+ const errors = [];
191
+ errors.push(...validateGuardBoundaryDecisionV1(input.guardDecision).errors);
192
+ errors.push(...validatePrecallEvaluationV1(input.precallEvaluation).errors);
193
+ errors.push(...validateOpaqueRef(input.auditRef, "audit_ref").errors);
194
+ errors.push(...validateOpaqueRef(input.conformanceRef, "conformance_ref").errors);
195
+ if (workflowId === undefined)
196
+ errors.push("precall workflow_id is required");
197
+ if (attemptId === undefined)
198
+ errors.push("precall attempt_id is required");
199
+ if (input.guardDecision.status !== "eligible")
200
+ errors.push("guard boundary must be eligible");
201
+ if (!hasPassedGuardCheck(input.guardDecision, "audit", input.auditRef))
202
+ errors.push("guard boundary must include matching passed audit ref");
203
+ if (!hasPassedGuardCheck(input.guardDecision, "conformance", input.conformanceRef))
204
+ errors.push("guard boundary must include matching passed conformance ref");
205
+ if (input.precallEvaluation.ok !== true)
206
+ errors.push("precall evaluation must be ok");
207
+ if (input.precallEvaluation.state !== "sdk_call_permitted")
208
+ errors.push("precall evaluation must be sdk_call_permitted");
209
+ if (input.precallEvaluation.sdk_call_permitted !== true)
210
+ errors.push("precall sdk_call_permitted must be true");
211
+ if ((input.precallEvaluation.blocked_labels?.length ?? 0) !== 0)
212
+ errors.push("precall evaluation must not carry blocked labels");
213
+ if (workflowId !== undefined && attemptId !== undefined)
214
+ errors.push(...consumedApprovalErrors(input.consumedApproval, workflowId, attemptId, "managed_dispatch_beta"));
215
+ if (errors.length > 0)
216
+ return blockedResult("managed_dispatch_beta", errors, workflowId, attemptId);
217
+ return {
218
+ schema_version: "flowdesk.authority_promotion_result.v1",
219
+ workflow_id: workflowId,
220
+ attempt_id: attemptId,
221
+ promotion_kind: "managed_dispatch_beta",
222
+ state: "managed_dispatch_beta_authority_enabled",
223
+ ok: true,
224
+ errors: [],
225
+ ...disabledPromotionAuthority,
226
+ managed_dispatch_beta_authority_enabled: true,
227
+ };
228
+ }
229
+ export function promoteFlowDeskReviewerTypedVerdictsV1(input) {
230
+ const errors = [];
231
+ errors.push(...validateOpaqueId(input.workflowId, "workflow_id").errors);
232
+ errors.push(...validateOpaqueId(input.attemptId, "attempt_id").errors);
233
+ errors.push(...consumedApprovalErrors(input.consumedApproval, input.workflowId, input.attemptId, "reviewer_fanout"));
234
+ const verdicts = Array.isArray(input.verdicts) ? input.verdicts : [];
235
+ if (!Array.isArray(input.verdicts))
236
+ errors.push("verdicts must be an array");
237
+ const seenVerdictIds = new Set();
238
+ const seenPerspectives = new Set();
239
+ for (const [index, verdict] of verdicts.entries()) {
240
+ const result = validateTopTierReviewVerdictV1(verdict);
241
+ errors.push(...result.errors.map((error) => `verdicts[${index}]: ${error}`));
242
+ if (!isRecord(verdict))
243
+ continue;
244
+ const record = verdict;
245
+ if (record.workflow_id !== input.workflowId)
246
+ errors.push(`verdicts[${index}] workflow_id mismatch`);
247
+ if (record.verdict_label !== "pass")
248
+ errors.push(`verdicts[${index}] verdict_label must be pass`);
249
+ if (record.uncertainty !== "low")
250
+ errors.push(`verdicts[${index}] uncertainty must be low`);
251
+ if (!Array.isArray(record.evidence_refs) || record.evidence_refs.length === 0)
252
+ errors.push(`verdicts[${index}] evidence_refs must be non-empty`);
253
+ if (typeof record.verdict_id === "string") {
254
+ if (seenVerdictIds.has(record.verdict_id))
255
+ errors.push(`verdicts[${index}] verdict_id must be distinct`);
256
+ seenVerdictIds.add(record.verdict_id);
257
+ }
258
+ if (typeof record.perspective === "string") {
259
+ if (seenPerspectives.has(record.perspective))
260
+ errors.push(`verdicts[${index}] perspective must be distinct`);
261
+ seenPerspectives.add(record.perspective);
262
+ }
263
+ }
264
+ for (const perspective of FLOWDESK_TOP_TIER_REVIEW_PERSPECTIVES) {
265
+ if (!seenPerspectives.has(perspective))
266
+ errors.push(`missing required reviewer perspective: ${perspective}`);
267
+ }
268
+ if (verdicts.length !== FLOWDESK_TOP_TIER_REVIEW_PERSPECTIVES.length)
269
+ errors.push("verdicts must contain exactly the canonical perspectives");
270
+ if (errors.length > 0)
271
+ return blockedResult("reviewer_typed_verdict_acceptance", errors, input.workflowId, input.attemptId);
272
+ return {
273
+ schema_version: "flowdesk.authority_promotion_result.v1",
274
+ workflow_id: input.workflowId,
275
+ attempt_id: input.attemptId,
276
+ promotion_kind: "reviewer_typed_verdict_acceptance",
277
+ state: "typed_verdicts_accepted",
278
+ ok: true,
279
+ errors: [],
280
+ accepted_verdict_ids: verdicts.map((verdict) => verdict.verdict_id),
281
+ accepted_perspectives: [...FLOWDESK_TOP_TIER_REVIEW_PERSPECTIVES],
282
+ ...disabledPromotionAuthority,
283
+ typed_reviewer_verdict_acceptance_enabled: true,
284
+ };
285
+ }
286
+ export function promoteFlowDeskFallbackReselectionRegateV1(input) {
287
+ const errors = [];
288
+ const decisionResult = validateFlowDeskFallbackDecisionV1(input.decision);
289
+ errors.push(...decisionResult.errors);
290
+ if (input.decision.state !== "requires_full_regate")
291
+ errors.push("fallback decision state must be requires_full_regate");
292
+ if (input.decision.automatic_fallback_authorized !== false)
293
+ errors.push("automatic fallback must not be authorized");
294
+ errors.push(...consumedApprovalErrors(input.consumedApproval, input.decision.workflow_id, input.decision.new_attempt_id, "fallback_reselection"));
295
+ if (input.consumedApproval.approval_id !== input.decision.fresh_approval_ref)
296
+ errors.push("fallback approval ref mismatch");
297
+ if (errors.length > 0)
298
+ return blockedResult("fallback_reselection_regate", errors, input.decision.workflow_id, input.decision.new_attempt_id);
299
+ return {
300
+ schema_version: "flowdesk.authority_promotion_result.v1",
301
+ workflow_id: input.decision.workflow_id,
302
+ attempt_id: input.decision.new_attempt_id,
303
+ promotion_kind: "fallback_reselection_regate",
304
+ state: "reselection_regate_authority_enabled",
305
+ ok: true,
306
+ errors: [],
307
+ ...disabledPromotionAuthority,
308
+ fallback_reselection_regate_authority_enabled: true,
309
+ };
310
+ }
311
+ export function validateFlowDeskControlledExternalWriteRequestV1(value) {
312
+ if (!isRecord(value))
313
+ return invalid("controlled external write request must be an object");
314
+ const record = value;
315
+ const errors = [];
316
+ const allowed = [
317
+ "schema_version",
318
+ "request_id",
319
+ "workflow_id",
320
+ "attempt_id",
321
+ "target_kind",
322
+ "target_ref",
323
+ "redaction_policy_ref",
324
+ "content_hash_ref",
325
+ "pre_write_audit_ref",
326
+ "dry_run_ref",
327
+ "created_at",
328
+ "external_write_authority_enabled",
329
+ "dispatch_authority_enabled",
330
+ "providerCall",
331
+ "actualLaneLaunch",
332
+ "runtimeExecution",
333
+ ];
334
+ errors.push(...rejectUnknownProperties(record, allowed, "controlled external write request")
335
+ .errors);
336
+ errors.push(...validateForbiddenAuthorityFields(record, allowed, "controlled external write request").errors);
337
+ if (record.schema_version !== "flowdesk.controlled_external_write_request.v1")
338
+ errors.push("controlled external write request schema_version is invalid");
339
+ errors.push(...validateOpaqueId(record.request_id, "request_id").errors);
340
+ errors.push(...validateOpaqueId(record.workflow_id, "workflow_id").errors);
341
+ errors.push(...validateOpaqueId(record.attempt_id, "attempt_id").errors);
342
+ if (typeof record.target_kind !== "string" ||
343
+ !FLOWDESK_CONTROLLED_EXTERNAL_WRITE_TARGET_KINDS.includes(record.target_kind))
344
+ errors.push("target_kind is not controlled or allowed");
345
+ for (const [ref, label] of [
346
+ [record.target_ref, "target_ref"],
347
+ [record.redaction_policy_ref, "redaction_policy_ref"],
348
+ [record.pre_write_audit_ref, "pre_write_audit_ref"],
349
+ [record.dry_run_ref, "dry_run_ref"],
350
+ ])
351
+ errors.push(...validateOpaqueRef(ref, label).errors);
352
+ errors.push(...validateHashRef(record.content_hash_ref, "content_hash_ref").errors);
353
+ errors.push(...validateTimestamp(record.created_at, "created_at").errors);
354
+ if (typeof record.target_ref === "string" &&
355
+ /(github|gitlab|connector|storage|bucket|blob|s3|gs|file|path|filesystem|database|sql|http|https|raw[_-]?payload|provider[_-]?payload|providerpayload)/i.test(record.target_ref))
356
+ errors.push("target_ref must not identify GitHub, connector, storage, path, database, URL, or raw payload targets");
357
+ if (record.external_write_authority_enabled !== false ||
358
+ record.dispatch_authority_enabled !== false ||
359
+ record.providerCall !== false ||
360
+ record.actualLaneLaunch !== false ||
361
+ record.runtimeExecution !== false)
362
+ errors.push("controlled external write request cannot enable authority");
363
+ errors.push(...validateNoForbiddenRawPayloads(record, "controlled_external_write_request")
364
+ .errors);
365
+ return errors.length === 0 ? valid() : invalid(...errors);
366
+ }
367
+ export function promoteFlowDeskExternalWriteAuthorityV1(input) {
368
+ const errors = [];
369
+ const requestResult = validateFlowDeskControlledExternalWriteRequestV1(input.request);
370
+ errors.push(...requestResult.errors);
371
+ errors.push(...consumedApprovalErrors(input.consumedApproval, input.request.workflow_id, input.request.attempt_id, "external_write"));
372
+ if (errors.length > 0)
373
+ return blockedResult("external_write", errors, input.request.workflow_id, input.request.attempt_id);
374
+ return {
375
+ schema_version: "flowdesk.authority_promotion_result.v1",
376
+ workflow_id: input.request.workflow_id,
377
+ attempt_id: input.request.attempt_id,
378
+ promotion_kind: "external_write",
379
+ state: "external_write_authority_enabled",
380
+ ok: true,
381
+ errors: [],
382
+ target_kind: input.request.target_kind,
383
+ target_ref: input.request.target_ref,
384
+ ...disabledPromotionAuthority,
385
+ external_write_authority_enabled: true,
386
+ };
387
+ }
388
+ //# sourceMappingURL=authority-promotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authority-promotion.js","sourceRoot":"","sources":["../src/authority-promotion.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kCAAkC,GAClC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAGN,0CAA0C,GAC1C,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,qCAAqC,GAErC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,OAAO,EAEP,KAAK,EACL,8BAA8B,EAC9B,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,GAC9B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC9D,uBAAuB;IACvB,yBAAyB;CAChB,CAAC;AAsDX,MAAM,0BAA0B,GAAG;IAClC,uCAAuC,EAAE,KAAK;IAC9C,yCAAyC,EAAE,KAAK;IAChD,6CAA6C,EAAE,KAAK;IACpD,gCAAgC,EAAE,KAAK;IACvC,0BAA0B,EAAE,KAAc;IAC1C,6BAA6B,EAAE,KAAc;IAC7C,oBAAoB,EAAE,KAAc;IACpC,YAAY,EAAE,KAAc;IAC5B,gBAAgB,EAAE,KAAc;IAChC,gBAAgB,EAAE,KAAc;CAChC,CAAC;AAEF,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,uBAAuB,CAC/B,KAA8B,EAC9B,OAA0B,EAC1B,KAAa;IAEb,MAAM,OAAO,G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B,KAAK,CAAC,OAAO,CAAC,UAAU,CACxB,CAAC;IACH,OAAO;QACN,cAAc,EAAE,wCAAwC;QACxD,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;QACtC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU;QACpC,cAAc,EAAE,gBAAgB;QAChC,KAAK,EAAE,kCAAkC;QACzC,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;QACtC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU;QACpC,GAAG,0BAA0B;QAC7B,gCAAgC,EAAE,IAAI;KACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { type ValidationResult } from "./validators.js";
2
+ export declare const FLOWDESK_PERMISSION_ASK_DECISIONS: readonly ["ask", "deny", "allow"];
3
+ export type FlowDeskPermissionAskDecisionStatusV1 = (typeof FLOWDESK_PERMISSION_ASK_DECISIONS)[number];
4
+ export declare const FLOWDESK_PERMISSION_DENY_REASONS: readonly ["non_dispatch_release1_default", "policy_pack_forbid", "guard_unapproved", "hard_chat_authority_required", "redacted_unsafe_action", "raw_payload_forbidden", "missing_durable_evidence"];
5
+ export type FlowDeskPermissionDenyReasonV1 = (typeof FLOWDESK_PERMISSION_DENY_REASONS)[number];
6
+ export interface FlowDeskPermissionAskDecisionV1 {
7
+ schema_version: "flowdesk.permission_ask_decision.v1";
8
+ decision_id: string;
9
+ workflow_id: string;
10
+ attempt_id: string;
11
+ session_ref: string;
12
+ requested_permission_kind_ref: string;
13
+ policy_pack_ref: string;
14
+ status: FlowDeskPermissionAskDecisionStatusV1;
15
+ deny_reason?: FlowDeskPermissionDenyReasonV1;
16
+ observed_at: string;
17
+ dispatch_authority_enabled: false;
18
+ providerCall: false;
19
+ actualLaneLaunch: false;
20
+ runtimeExecution: false;
21
+ hardCancelOrNoReplyAuthority: false;
22
+ }
23
+ export declare const FLOWDESK_SESSION_ABORT_REASONS: readonly ["user_requested_abort", "guard_revoked", "approval_expired", "policy_violation_detected", "stale_evidence_detected", "orphan_lane_cleanup", "provider_failure_terminal"];
24
+ export type FlowDeskSessionAbortReasonV1 = (typeof FLOWDESK_SESSION_ABORT_REASONS)[number];
25
+ export interface FlowDeskSessionAbortDecisionV1 {
26
+ schema_version: "flowdesk.session_abort_decision.v1";
27
+ decision_id: string;
28
+ workflow_id: string;
29
+ attempt_id: string;
30
+ session_ref: string;
31
+ abort_reason: FlowDeskSessionAbortReasonV1;
32
+ policy_pack_ref: string;
33
+ guard_decision_ref: string;
34
+ pre_abort_audit_ref: string;
35
+ created_at: string;
36
+ dispatch_authority_enabled: false;
37
+ providerCall: false;
38
+ actualLaneLaunch: false;
39
+ runtimeExecution: false;
40
+ hardCancelOrNoReplyAuthority: false;
41
+ session_abort_authorized: true;
42
+ }
43
+ export declare const FLOWDESK_PROMPT_NO_REPLY_REASONS: readonly ["context_commit_only", "audit_breadcrumb_only", "recovery_state_only", "fallback_pre_reset_only"];
44
+ export type FlowDeskPromptNoReplyReasonV1 = (typeof FLOWDESK_PROMPT_NO_REPLY_REASONS)[number];
45
+ export interface FlowDeskPromptNoReplyDecisionV1 {
46
+ schema_version: "flowdesk.prompt_no_reply_decision.v1";
47
+ decision_id: string;
48
+ workflow_id: string;
49
+ attempt_id: string;
50
+ session_ref: string;
51
+ agent_ref: string;
52
+ provider_qualified_model_id: string;
53
+ no_reply_reason: FlowDeskPromptNoReplyReasonV1;
54
+ policy_pack_ref: string;
55
+ guard_decision_ref: string;
56
+ pre_call_audit_ref: string;
57
+ created_at: string;
58
+ dispatch_authority_enabled: false;
59
+ providerCall: true;
60
+ actualLaneLaunch: false;
61
+ runtimeExecution: true;
62
+ hardCancelOrNoReplyAuthority: false;
63
+ prompt_no_reply_authorized: true;
64
+ }
65
+ export declare function validateFlowDeskPermissionAskDecisionV1(value: unknown): ValidationResult;
66
+ export declare function validateFlowDeskSessionAbortDecisionV1(value: unknown): ValidationResult;
67
+ export declare function validateFlowDeskPromptNoReplyDecisionV1(value: unknown): ValidationResult;
68
+ export interface FlowDeskPermissionAskInputV1 {
69
+ decisionId: string;
70
+ workflowId: string;
71
+ attemptId: string;
72
+ sessionRef: string;
73
+ requestedPermissionKindRef: string;
74
+ policyPackRef: string;
75
+ observedAt: string;
76
+ policyAllows?: boolean;
77
+ guardApproved?: boolean;
78
+ requiresHardChatAuthority?: boolean;
79
+ durableEvidenceMissing?: boolean;
80
+ rawPayloadDetected?: boolean;
81
+ }
82
+ export declare function evaluateFlowDeskPermissionAskDecisionV1(input: FlowDeskPermissionAskInputV1): FlowDeskPermissionAskDecisionV1;
83
+ //# sourceMappingURL=chat-control-authority.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-control-authority.d.ts","sourceRoot":"","sources":["../src/chat-control-authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,gBAAgB,EAMrB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,iCAAiC,mCAIpC,CAAC;AACX,MAAM,MAAM,qCAAqC,GAChD,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,gCAAgC,qMAQnC,CAAC;AACX,MAAM,MAAM,8BAA8B,GACzC,CAAC,OAAO,gCAAgC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,WAAW,+BAA+B;IAC/C,cAAc,EAAE,qCAAqC,CAAC;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B,EAAE,MAAM,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,qCAAqC,CAAC;IAC9C,WAAW,CAAC,EAAE,8BAA8B,CAAC;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B,EAAE,KAAK,CA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