@synapsor/runner 1.6.2 → 1.6.4
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/AGENTS.md +2 -2
- package/CHANGELOG.md +141 -2
- package/CONTRIBUTING.md +10 -3
- package/README.md +65 -83
- package/SECURITY.md +14 -2
- package/THREAT_MODEL.md +64 -4
- package/dist/authoring.mjs +151 -16
- package/dist/cli.d.ts +31 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/local-ui.d.ts +145 -1
- package/dist/local-ui.d.ts.map +1 -1
- package/dist/runner.mjs +37488 -19009
- package/dist/runtime.mjs +4056 -235
- package/dist/shadow.mjs +2423 -65
- package/docs/README.md +36 -2
- package/docs/agent-guided-setup.md +239 -0
- package/docs/aggregate-reads.md +14 -5
- package/docs/app-owned-executors.md +5 -6
- package/docs/approval-roles-and-operator-identity.md +353 -0
- package/docs/auto-boundary-and-scoped-explore.md +89 -11
- package/docs/capability-authoring.md +21 -2
- package/docs/client-recipes.md +1 -1
- package/docs/cloud-mode.md +7 -7
- package/docs/conformance.md +6 -3
- package/docs/current-scope.md +32 -2
- package/docs/cursor-plugin.md +3 -3
- package/docs/database-enforced-scope.md +6 -0
- package/docs/dsl-json-parity.md +75 -0
- package/docs/dsl-reference.md +22 -1
- package/docs/fresh-developer-usability.md +155 -80
- package/docs/getting-started-own-database.md +45 -44
- package/docs/guarded-crud-writeback.md +19 -0
- package/docs/guided-onboarding.md +399 -0
- package/docs/human-attention-notifications.md +367 -0
- package/docs/limitations.md +49 -13
- package/docs/local-mode.md +36 -22
- package/docs/mcp-audit.md +14 -14
- package/docs/mcp-client-setup.md +11 -14
- package/docs/mcp-clients.md +1 -1
- package/docs/migrating-to-synapsor-spec.md +42 -0
- package/docs/openai-agents-sdk.md +2 -2
- package/docs/production.md +39 -0
- package/docs/proposal-evidence-freshness.md +7 -7
- package/docs/recipes.md +6 -6
- package/docs/release-notes.md +144 -4
- package/docs/release-policy.md +20 -7
- package/docs/reversible-change-sets.md +1 -1
- package/docs/reviewed-database-views.md +132 -0
- package/docs/reviewed-relationships.md +245 -0
- package/docs/rfcs/006-reviewed-reversible-change-sets.md +1 -1
- package/docs/runner-bundles.md +7 -7
- package/docs/runner-config-reference.md +132 -0
- package/docs/running-a-runner-fleet.md +16 -1
- package/docs/schema-api-candidates.md +1 -1
- package/docs/security-boundary.md +54 -0
- package/docs/store-lifecycle.md +20 -1
- package/docs/supervised-automatic-apply.md +267 -0
- package/docs/troubleshooting-first-run.md +85 -10
- package/docs/use-your-own-database.md +6 -4
- package/docs/workbench-ask.md +279 -0
- package/docs/writeback-executors.md +7 -7
- package/examples/auto-boundary-churn/README.md +1 -1
- package/examples/community-solar-clean-room/README.md +7 -0
- package/examples/community-solar-clean-room/docker-compose.yml +16 -0
- package/examples/community-solar-clean-room/package.json +15 -0
- package/examples/community-solar-clean-room/prisma/schema.prisma +171 -0
- package/examples/community-solar-clean-room/seed/postgres.sql +571 -0
- package/examples/fitflow-guided-onboarding/README.md +43 -0
- package/examples/fitflow-guided-onboarding/app/page.tsx +8 -0
- package/examples/fitflow-guided-onboarding/docker-compose.yml +16 -0
- package/examples/fitflow-guided-onboarding/package.json +18 -0
- package/examples/fitflow-guided-onboarding/prisma/schema.prisma +98 -0
- package/examples/fitflow-guided-onboarding/seed/postgres.sql +401 -0
- package/examples/openai-agents-http/Makefile +1 -1
- package/examples/openai-agents-http/README.md +1 -1
- package/examples/openai-agents-stdio/Makefile +1 -1
- package/examples/openai-agents-stdio/README.md +2 -2
- package/examples/openai-agents-stdio/agent.py +1 -4
- package/examples/operator-oidc/issuer.mjs +188 -0
- package/examples/reference-support-billing-app/README.md +16 -16
- package/examples/retail-clean-room/README.md +7 -0
- package/examples/retail-clean-room/docker-compose.yml +16 -0
- package/examples/retail-clean-room/package.json +9 -0
- package/examples/retail-clean-room/prisma/schema.prisma +239 -0
- package/examples/retail-clean-room/seed/postgres.sql +781 -0
- package/examples/retail-clean-room/view-recipe/average-retained-revenue.synapsor.sql +21 -0
- package/examples/retail-clean-room/view-recipe/synapsor.runner.json +25 -0
- package/examples/support-plan-credit/README.md +6 -2
- package/examples/support-plan-credit/mcp-client-examples/claude-code.sh +1 -4
- package/examples/support-plan-credit/mcp-client-examples/claude-desktop.json +1 -4
- package/examples/support-plan-credit/mcp-client-examples/codex.config.toml +1 -4
- package/examples/support-plan-credit/mcp-client-examples/cursor-global.mcp.json +1 -4
- package/examples/support-plan-credit/mcp-client-examples/cursor-project.mcp.json +1 -4
- package/examples/support-plan-credit/mcp-client-examples/generic-stdio.json +1 -4
- package/examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs +1 -1
- package/examples/support-plan-credit/mcp-client-examples/google-adk.py +1 -1
- package/examples/support-plan-credit/mcp-client-examples/langchain.mjs +1 -1
- package/examples/support-plan-credit/mcp-client-examples/llamaindex.py +1 -1
- package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +1 -1
- package/examples/support-plan-credit/mcp-client-examples/vscode.mcp.json +1 -4
- package/fixtures/compatibility/published-1.6.3/manifest.json +76 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/dsl/examples/aggregate-read.synapsor.sql +21 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/dsl/examples/billing-late-fee.synapsor.sql +56 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/dsl/examples/bounded-set-multi-term.synapsor.sql +30 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/dsl/examples/principal-row-scope.synapsor.sql +23 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/aggregate-read/contract.json +119 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/approval-quorum/contract.json +44 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/bounded-set-threats/contract.json +115 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/principal-row-scope/contract.json +78 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/proposal-capability/contract.json +101 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/conformance/reversible-change-sets/contract.json +98 -0
- package/fixtures/compatibility/published-1.6.3/sources/packages/spec/fixtures/valid/basic-read.contract.json +60 -0
- package/llms.txt +10 -5
- package/package.json +11 -3
- package/schemas/schema-candidate-review.schema.json +42 -0
- package/schemas/synapsor.runner.schema.json +227 -4
package/dist/authoring.mjs
CHANGED
|
@@ -37,7 +37,7 @@ var SUBJECT_KEYS = /* @__PURE__ */ new Set(["resource", "schema", "table", "prim
|
|
|
37
37
|
var ARG_KEYS = /* @__PURE__ */ new Set(["type", "description", "required", "max_length", "minimum", "maximum", "enum", "max_items", "fields"]);
|
|
38
38
|
var LOOKUP_KEYS = /* @__PURE__ */ new Set(["id_from_arg"]);
|
|
39
39
|
var EVIDENCE_KEYS = /* @__PURE__ */ new Set(["required", "sources", "query_audit", "handle_prefix"]);
|
|
40
|
-
var PROPOSAL_KEYS = /* @__PURE__ */ new Set(["action", "operation", "allowed_fields", "patch", "numeric_bounds", "transition_guards", "reversibility", "conflict_guard", "approval", "writeback"]);
|
|
40
|
+
var PROPOSAL_KEYS = /* @__PURE__ */ new Set(["action", "operation", "allowed_fields", "patch", "numeric_bounds", "transition_guards", "reversibility", "conflict_guard", "approval", "execution", "writeback"]);
|
|
41
41
|
var OPERATION_KEYS = /* @__PURE__ */ new Set(["kind", "cardinality", "selection", "max_rows", "aggregate_bounds", "batch", "deduplication", "version_advance"]);
|
|
42
42
|
var SELECTION_KEYS = /* @__PURE__ */ new Set(["all"]);
|
|
43
43
|
var PREDICATE_TERM_KEYS = /* @__PURE__ */ new Set(["column", "operator", "value"]);
|
|
@@ -52,6 +52,7 @@ var NUMERIC_BOUND_KEYS = /* @__PURE__ */ new Set(["minimum", "maximum"]);
|
|
|
52
52
|
var TRANSITION_GUARD_KEYS = /* @__PURE__ */ new Set(["from_column", "allowed"]);
|
|
53
53
|
var CONFLICT_GUARD_KEYS = /* @__PURE__ */ new Set(["column", "weak_guard_ack"]);
|
|
54
54
|
var APPROVAL_KEYS = /* @__PURE__ */ new Set(["mode", "required_role", "required_approvals", "policy"]);
|
|
55
|
+
var EXECUTION_KEYS = /* @__PURE__ */ new Set(["supervised_worker"]);
|
|
55
56
|
var WRITEBACK_KEYS = /* @__PURE__ */ new Set(["mode", "executor", "idempotency_key"]);
|
|
56
57
|
var REVERSIBILITY_KEYS = /* @__PURE__ */ new Set(["mode"]);
|
|
57
58
|
var AGGREGATE_READ_KEYS = /* @__PURE__ */ new Set(["function", "count_mode", "column", "selection", "minimum_group_size"]);
|
|
@@ -62,6 +63,7 @@ var PROTECTED_READ_KEYS = /* @__PURE__ */ new Set([
|
|
|
62
63
|
"generation_lock_fingerprint",
|
|
63
64
|
"predicates",
|
|
64
65
|
"relationship",
|
|
66
|
+
"relationships",
|
|
65
67
|
"row_order_by",
|
|
66
68
|
"aggregate",
|
|
67
69
|
"limits"
|
|
@@ -80,6 +82,19 @@ var PROTECTED_RELATIONSHIP_KEYS = /* @__PURE__ */ new Set([
|
|
|
80
82
|
"cardinality",
|
|
81
83
|
"max_fan_out"
|
|
82
84
|
]);
|
|
85
|
+
var PROTECTED_RELATIONSHIP_PATH_KEYS = /* @__PURE__ */ new Set(["name", "links"]);
|
|
86
|
+
var PROTECTED_RELATIONSHIP_LINK_KEYS = /* @__PURE__ */ new Set([
|
|
87
|
+
"schema",
|
|
88
|
+
"table",
|
|
89
|
+
"primary_key",
|
|
90
|
+
"tenant_key",
|
|
91
|
+
"principal_scope_key",
|
|
92
|
+
"local_key",
|
|
93
|
+
"target_key",
|
|
94
|
+
"cardinality",
|
|
95
|
+
"max_fan_out",
|
|
96
|
+
"unmatched_rows"
|
|
97
|
+
]);
|
|
83
98
|
var PROTECTED_ROW_ORDER_KEYS = /* @__PURE__ */ new Set(["field", "direction"]);
|
|
84
99
|
var PROTECTED_AGGREGATE_KEYS = /* @__PURE__ */ new Set([
|
|
85
100
|
"counted_entity",
|
|
@@ -273,8 +288,8 @@ function validateContexts(value, errors, warnings) {
|
|
|
273
288
|
}
|
|
274
289
|
function validateCapabilities(value, contextNames, resourceNames, errors, warnings) {
|
|
275
290
|
const names = /* @__PURE__ */ new Set();
|
|
276
|
-
if (!Array.isArray(value)
|
|
277
|
-
errors.push({ path: "$.capabilities", code: "CAPABILITIES_REQUIRED", message: "
|
|
291
|
+
if (!Array.isArray(value)) {
|
|
292
|
+
errors.push({ path: "$.capabilities", code: "CAPABILITIES_REQUIRED", message: "capabilities must be an array; an empty array represents zero authority." });
|
|
278
293
|
return names;
|
|
279
294
|
}
|
|
280
295
|
value.forEach((capability, index) => {
|
|
@@ -544,7 +559,18 @@ function validateProtectedRead(capability, path, errors) {
|
|
|
544
559
|
const keptOut = new Set(Array.isArray(capability.kept_out_fields) ? capability.kept_out_fields.filter((field) => typeof field === "string") : []);
|
|
545
560
|
const subject = isRecord(capability.subject) ? capability.subject : {};
|
|
546
561
|
const trustedScopeFields = new Set([subject.tenant_key, subject.principal_scope_key].filter((field) => isSafeIdentifier(field)));
|
|
547
|
-
const
|
|
562
|
+
const relationshipNames = /* @__PURE__ */ new Set();
|
|
563
|
+
const legacyRelationshipName = validateProtectedRelationship(protectedRead.relationship, keptOut, trustedScopeFields, `${path}.protected_read.relationship`, errors);
|
|
564
|
+
if (legacyRelationshipName)
|
|
565
|
+
relationshipNames.add(legacyRelationshipName);
|
|
566
|
+
if (protectedRead.relationship !== void 0 && protectedRead.relationships !== void 0) {
|
|
567
|
+
errors.push({
|
|
568
|
+
path: `${path}.protected_read`,
|
|
569
|
+
code: "PROTECTED_RELATIONSHIP_FORMS_CONFLICT",
|
|
570
|
+
message: "protected_read must use either legacy relationship or reviewed relationships, not both."
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
validateProtectedRelationshipPaths(protectedRead.relationships, keptOut, trustedScopeFields, `${path}.protected_read.relationships`, relationshipNames, errors);
|
|
548
574
|
if (!isRecord(capability.evidence) || capability.evidence.required !== true || capability.evidence.query_audit !== true) {
|
|
549
575
|
errors.push({
|
|
550
576
|
path: `${path}.evidence`,
|
|
@@ -563,7 +589,7 @@ function validateProtectedRead(capability, path, errors) {
|
|
|
563
589
|
return;
|
|
564
590
|
}
|
|
565
591
|
checkUnknownKeys(predicate, PROTECTED_PREDICATE_KEYS, predicatePath, errors);
|
|
566
|
-
validateProtectedFieldReference(predicate.field, predicate.relationship,
|
|
592
|
+
validateProtectedFieldReference(predicate.field, predicate.relationship, relationshipNames, keptOut, trustedScopeFields, predicatePath, errors);
|
|
567
593
|
if (!["eq", "neq", "lt", "lte", "gt", "gte", "in"].includes(String(predicate.operator))) {
|
|
568
594
|
errors.push({ path: `${predicatePath}.operator`, code: "INVALID_PROTECTED_PREDICATE_OPERATOR", message: "protected predicate operator must be eq, neq, lt, lte, gt, gte, or in." });
|
|
569
595
|
}
|
|
@@ -623,7 +649,7 @@ function validateProtectedRead(capability, path, errors) {
|
|
|
623
649
|
validateProtectedAggregate(protectedRead.aggregate, {
|
|
624
650
|
args,
|
|
625
651
|
referencedArgs,
|
|
626
|
-
|
|
652
|
+
relationshipNames,
|
|
627
653
|
keptOut,
|
|
628
654
|
trustedScopeFields,
|
|
629
655
|
maxGroups: isRecord(protectedRead.limits) ? protectedRead.limits.max_groups : void 0,
|
|
@@ -666,6 +692,65 @@ function validateProtectedRelationship(value, keptOut, trustedScopeFields, path,
|
|
|
666
692
|
}
|
|
667
693
|
return isSafeIdentifier(value.name) ? value.name : void 0;
|
|
668
694
|
}
|
|
695
|
+
function validateProtectedRelationshipPaths(value, keptOut, trustedScopeFields, path, relationshipNames, errors) {
|
|
696
|
+
if (value === void 0)
|
|
697
|
+
return;
|
|
698
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 3) {
|
|
699
|
+
errors.push({
|
|
700
|
+
path,
|
|
701
|
+
code: "INVALID_PROTECTED_RELATIONSHIP_PATHS",
|
|
702
|
+
message: "protected relationships must contain 1 through 3 reviewed paths."
|
|
703
|
+
});
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
value.forEach((candidate, pathIndex) => {
|
|
707
|
+
const candidatePath = `${path}[${pathIndex}]`;
|
|
708
|
+
if (!isRecord(candidate)) {
|
|
709
|
+
errors.push({ path: candidatePath, code: "PROTECTED_RELATIONSHIP_PATH_NOT_OBJECT", message: "protected relationship path must be an object." });
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
checkUnknownKeys(candidate, PROTECTED_RELATIONSHIP_PATH_KEYS, candidatePath, errors);
|
|
713
|
+
if (!isSafeIdentifier(candidate.name)) {
|
|
714
|
+
errors.push({ path: `${candidatePath}.name`, code: "INVALID_PROTECTED_RELATIONSHIP_IDENTIFIER", message: "relationship path name must be a fixed safe identifier." });
|
|
715
|
+
} else if (relationshipNames.has(candidate.name)) {
|
|
716
|
+
errors.push({ path: `${candidatePath}.name`, code: "DUPLICATE_PROTECTED_RELATIONSHIP", message: "protected relationship names must be unique." });
|
|
717
|
+
} else {
|
|
718
|
+
relationshipNames.add(candidate.name);
|
|
719
|
+
}
|
|
720
|
+
if (!Array.isArray(candidate.links) || candidate.links.length < 1 || candidate.links.length > 2) {
|
|
721
|
+
errors.push({ path: `${candidatePath}.links`, code: "INVALID_PROTECTED_RELATIONSHIP_LINKS", message: "a protected relationship path requires one or two reviewed many-to-one links." });
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
candidate.links.forEach((link, linkIndex) => {
|
|
725
|
+
const linkPath = `${candidatePath}.links[${linkIndex}]`;
|
|
726
|
+
if (!isRecord(link)) {
|
|
727
|
+
errors.push({ path: linkPath, code: "PROTECTED_RELATIONSHIP_LINK_NOT_OBJECT", message: "protected relationship link must be an object." });
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
checkUnknownKeys(link, PROTECTED_RELATIONSHIP_LINK_KEYS, linkPath, errors);
|
|
731
|
+
for (const key of ["schema", "table", "primary_key", "tenant_key", "local_key", "target_key"]) {
|
|
732
|
+
if (!isSafeIdentifier(link[key]))
|
|
733
|
+
errors.push({ path: `${linkPath}.${key}`, code: "INVALID_PROTECTED_RELATIONSHIP_IDENTIFIER", message: `${key} must be a fixed safe identifier.` });
|
|
734
|
+
}
|
|
735
|
+
if (link.principal_scope_key !== void 0 && !isSafeIdentifier(link.principal_scope_key)) {
|
|
736
|
+
errors.push({ path: `${linkPath}.principal_scope_key`, code: "INVALID_PROTECTED_RELATIONSHIP_IDENTIFIER", message: "principal_scope_key must be a fixed safe identifier." });
|
|
737
|
+
}
|
|
738
|
+
if (link.cardinality !== "many_to_one" || link.max_fan_out !== 1) {
|
|
739
|
+
errors.push({ path: linkPath, code: "PROTECTED_RELATIONSHIP_CARDINALITY_FORBIDDEN", message: "every protected relationship link must be reviewed many-to-one with max_fan_out 1." });
|
|
740
|
+
}
|
|
741
|
+
if (link.unmatched_rows !== "exclude" && link.unmatched_rows !== "keep_null") {
|
|
742
|
+
errors.push({ path: `${linkPath}.unmatched_rows`, code: "PROTECTED_RELATIONSHIP_NULL_SEMANTICS_REQUIRED", message: "every protected relationship link must freeze exclude or keep_null unmatched-row semantics." });
|
|
743
|
+
}
|
|
744
|
+
if (linkIndex === 0 && isSafeIdentifier(link.local_key) && (keptOut.has(link.local_key) || trustedScopeFields.has(link.local_key))) {
|
|
745
|
+
errors.push({
|
|
746
|
+
path: `${linkPath}.local_key`,
|
|
747
|
+
code: "PROTECTED_RELATIONSHIP_LOCAL_KEY_FORBIDDEN",
|
|
748
|
+
message: "the reviewed relationship cannot join through a kept-out or trusted-scope subject field."
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
}
|
|
669
754
|
function validateProtectedAggregate(value, input) {
|
|
670
755
|
const { path, errors } = input;
|
|
671
756
|
if (!isRecord(value)) {
|
|
@@ -689,14 +774,14 @@ function validateProtectedAggregate(value, input) {
|
|
|
689
774
|
validateUniqueIdentifier(measure.name, measureNames, `${measurePath}.name`, "DUPLICATE_PROTECTED_MEASURE_NAME", errors);
|
|
690
775
|
if (!["count", "count_distinct", "sum", "avg"].includes(String(measure.function)))
|
|
691
776
|
errors.push({ path: `${measurePath}.function`, code: "INVALID_PROTECTED_MEASURE_FUNCTION", message: "measure function must be count, count_distinct, sum, or avg." });
|
|
692
|
-
validateProtectedRelationshipReference(measure.relationship, input.
|
|
777
|
+
validateProtectedRelationshipReference(measure.relationship, input.relationshipNames, `${measurePath}.relationship`, errors);
|
|
693
778
|
if (measure.function === "count") {
|
|
694
779
|
if (measure.field !== void 0)
|
|
695
780
|
errors.push({ path: `${measurePath}.field`, code: "PROTECTED_COUNT_FIELD_FORBIDDEN", message: "count measures count scoped subject rows and must not declare a field." });
|
|
696
781
|
if (measure.relationship !== void 0)
|
|
697
782
|
errors.push({ path: `${measurePath}.relationship`, code: "PROTECTED_COUNT_RELATIONSHIP_FORBIDDEN", message: "count measures count the scoped subject entity, not a joined relation." });
|
|
698
783
|
} else {
|
|
699
|
-
validateProtectedFieldReference(measure.field, measure.relationship, input.
|
|
784
|
+
validateProtectedFieldReference(measure.field, measure.relationship, input.relationshipNames, input.keptOut, input.trustedScopeFields, measurePath, errors);
|
|
700
785
|
}
|
|
701
786
|
});
|
|
702
787
|
}
|
|
@@ -713,7 +798,7 @@ function validateProtectedAggregate(value, input) {
|
|
|
713
798
|
}
|
|
714
799
|
checkUnknownKeys(dimension, PROTECTED_DIMENSION_KEYS, dimensionPath, errors);
|
|
715
800
|
validateUniqueIdentifier(dimension.name, dimensionNames, `${dimensionPath}.name`, "DUPLICATE_PROTECTED_DIMENSION_NAME", errors);
|
|
716
|
-
validateProtectedFieldReference(dimension.field, dimension.relationship, input.
|
|
801
|
+
validateProtectedFieldReference(dimension.field, dimension.relationship, input.relationshipNames, input.keptOut, input.trustedScopeFields, dimensionPath, errors);
|
|
717
802
|
});
|
|
718
803
|
}
|
|
719
804
|
}
|
|
@@ -727,7 +812,7 @@ function validateProtectedAggregate(value, input) {
|
|
|
727
812
|
errors.push({ path: `${bucketPath}.name`, code: "INVALID_PROTECTED_TIME_BUCKET_NAME", message: "time bucket name must be a safe identifier." });
|
|
728
813
|
if (value.time_bucket.bucket !== "day" && value.time_bucket.bucket !== "week" && value.time_bucket.bucket !== "month")
|
|
729
814
|
errors.push({ path: `${bucketPath}.bucket`, code: "INVALID_PROTECTED_TIME_BUCKET", message: "time bucket must be day, week, or month." });
|
|
730
|
-
validateProtectedFieldReference(value.time_bucket.field, value.time_bucket.relationship, input.
|
|
815
|
+
validateProtectedFieldReference(value.time_bucket.field, value.time_bucket.relationship, input.relationshipNames, input.keptOut, input.trustedScopeFields, bucketPath, errors);
|
|
731
816
|
}
|
|
732
817
|
}
|
|
733
818
|
if (value.comparison !== void 0) {
|
|
@@ -736,7 +821,7 @@ function validateProtectedAggregate(value, input) {
|
|
|
736
821
|
errors.push({ path: comparisonPath, code: "PROTECTED_COMPARISON_NOT_OBJECT", message: "comparison must be an object." });
|
|
737
822
|
} else {
|
|
738
823
|
checkUnknownKeys(value.comparison, PROTECTED_COMPARISON_KEYS, comparisonPath, errors);
|
|
739
|
-
validateProtectedFieldReference(value.comparison.field, value.comparison.relationship, input.
|
|
824
|
+
validateProtectedFieldReference(value.comparison.field, value.comparison.relationship, input.relationshipNames, input.keptOut, input.trustedScopeFields, comparisonPath, errors);
|
|
740
825
|
if (!Array.isArray(value.comparison.ranges) || value.comparison.ranges.length < 1 || value.comparison.ranges.length > 2) {
|
|
741
826
|
errors.push({ path: `${comparisonPath}.ranges`, code: "INVALID_PROTECTED_COMPARISON_RANGES", message: "comparison requires one or two bounded time ranges." });
|
|
742
827
|
} else {
|
|
@@ -827,19 +912,20 @@ function validateProtectedValue(value, args, referencedArgs, path, errors) {
|
|
|
827
912
|
}
|
|
828
913
|
}
|
|
829
914
|
}
|
|
830
|
-
function validateProtectedFieldReference(field, relationship,
|
|
915
|
+
function validateProtectedFieldReference(field, relationship, relationshipNames, keptOut, trustedScopeFields, path, errors) {
|
|
831
916
|
if (!isSafeIdentifier(field)) {
|
|
832
917
|
errors.push({ path: `${path}.field`, code: "INVALID_PROTECTED_FIELD", message: "protected field must be a fixed safe identifier." });
|
|
833
918
|
} else if (relationship === void 0 && (keptOut.has(field) || trustedScopeFields.has(field))) {
|
|
834
919
|
errors.push({ path: `${path}.field`, code: "PROTECTED_FIELD_FORBIDDEN", message: "kept-out and trusted-scope fields cannot be selected, filtered, grouped, sorted, joined, aggregated, or counted distinctly." });
|
|
835
920
|
}
|
|
836
|
-
validateProtectedRelationshipReference(relationship,
|
|
921
|
+
validateProtectedRelationshipReference(relationship, relationshipNames, `${path}.relationship`, errors);
|
|
837
922
|
}
|
|
838
|
-
function validateProtectedRelationshipReference(value,
|
|
923
|
+
function validateProtectedRelationshipReference(value, relationshipNames, path, errors) {
|
|
839
924
|
if (value === void 0)
|
|
840
925
|
return;
|
|
841
|
-
if (!isSafeIdentifier(value) || value
|
|
842
|
-
errors.push({ path, code: "UNKNOWN_PROTECTED_RELATIONSHIP", message: "relationship must reference the capability's
|
|
926
|
+
if (!isSafeIdentifier(value) || !relationshipNames.has(value)) {
|
|
927
|
+
errors.push({ path, code: "UNKNOWN_PROTECTED_RELATIONSHIP", message: "relationship must reference one of the capability's reviewed many-to-one paths." });
|
|
928
|
+
}
|
|
843
929
|
}
|
|
844
930
|
function validateUniqueIdentifier(value, seen, path, code, errors) {
|
|
845
931
|
if (!isSafeIdentifier(value)) {
|
|
@@ -1001,6 +1087,55 @@ function validateProposalAction(value, subject, path, errors) {
|
|
|
1001
1087
|
});
|
|
1002
1088
|
}
|
|
1003
1089
|
}
|
|
1090
|
+
if (value.execution !== void 0) {
|
|
1091
|
+
validateNestedObject(value.execution, EXECUTION_KEYS, `${path}.execution`, errors);
|
|
1092
|
+
if (isRecord(value.execution) && value.execution.supervised_worker !== "allowed") {
|
|
1093
|
+
errors.push({
|
|
1094
|
+
path: `${path}.execution.supervised_worker`,
|
|
1095
|
+
code: "INVALID_SUPERVISED_WORKER_PERMISSION",
|
|
1096
|
+
message: "execution.supervised_worker must be allowed when the optional permission is present."
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
if (isRecord(value.execution) && value.execution.supervised_worker === "allowed") {
|
|
1100
|
+
const cardinality = isRecord(value.operation) ? value.operation.cardinality ?? "single" : "single";
|
|
1101
|
+
const writebackMode = isRecord(value.writeback) ? value.writeback.mode : "direct_sql";
|
|
1102
|
+
if (writebackMode !== "direct_sql") {
|
|
1103
|
+
errors.push({
|
|
1104
|
+
path: `${path}.writeback.mode`,
|
|
1105
|
+
code: "SUPERVISED_WORKER_DIRECT_SQL_REQUIRED",
|
|
1106
|
+
message: "supervised-worker execution is initially limited to Runner-owned direct_sql writeback."
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
if (cardinality !== "single") {
|
|
1110
|
+
errors.push({
|
|
1111
|
+
path: `${path}.operation.cardinality`,
|
|
1112
|
+
code: "SUPERVISED_WORKER_SINGLE_ROW_REQUIRED",
|
|
1113
|
+
message: "supervised-worker execution is initially limited to deterministic single-row writes."
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
if (deleteOperation) {
|
|
1117
|
+
errors.push({
|
|
1118
|
+
path: `${path}.operation.kind`,
|
|
1119
|
+
code: "SUPERVISED_WORKER_DELETE_FORBIDDEN",
|
|
1120
|
+
message: "hard DELETE is not eligible for supervised-worker execution in this release."
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
if (value.reversibility !== void 0) {
|
|
1124
|
+
errors.push({
|
|
1125
|
+
path: `${path}.reversibility`,
|
|
1126
|
+
code: "SUPERVISED_WORKER_REVERSIBILITY_FORBIDDEN",
|
|
1127
|
+
message: "reviewed compensation actions require manual execution in this release."
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
if (operation === "update" && (!isRecord(value.conflict_guard) || !isSafeIdentifier(value.conflict_guard.column) || value.conflict_guard.weak_guard_ack === true)) {
|
|
1131
|
+
errors.push({
|
|
1132
|
+
path: `${path}.conflict_guard.column`,
|
|
1133
|
+
code: "SUPERVISED_WORKER_EXACT_CONFLICT_GUARD_REQUIRED",
|
|
1134
|
+
message: "supervised-worker UPDATE requires an exact source version/conflict column; a weak row hash is not eligible."
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1004
1139
|
if (value.writeback !== void 0) {
|
|
1005
1140
|
validateNestedObject(value.writeback, WRITEBACK_KEYS, `${path}.writeback`, errors);
|
|
1006
1141
|
if (isRecord(value.writeback) && !["direct_sql", "app_handler", "cloud_worker", "none"].includes(String(value.writeback.mode)))
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { type DbRowReader } from "@synapsor-runner/mcp-server";
|
|
3
|
-
import { type StoredWritebackIntent } from "@synapsor-runner/proposal-store";
|
|
2
|
+
import { type DbRowReader, type RuntimeCapabilityConfig, type RuntimeConfig, type RuntimeSupervisedWorkerCapabilityPolicy } from "@synapsor-runner/mcp-server";
|
|
3
|
+
import { ProposalStore, type PolicyApprovalLimit, type StoredProposal, type StoredWritebackIntent } from "@synapsor-runner/proposal-store";
|
|
4
4
|
import { type ExecutionReceiptV2, type ExecutionReceiptV3, type ExecutionReceiptV4, type WritebackJob } from "@synapsor-runner/protocol";
|
|
5
|
-
import { type SchemaInspection } from "@synapsor-runner/schema-inspector";
|
|
5
|
+
import { inspectDatabase, type SchemaInspection } from "@synapsor-runner/schema-inspector";
|
|
6
6
|
import { type ReconciliationObservation } from "@synapsor-runner/worker-core";
|
|
7
|
+
import { type WorkbenchDeploymentProfile } from "./local-ui.js";
|
|
7
8
|
export declare function main(argv: string[]): Promise<number>;
|
|
8
9
|
type WizardAsk = (question: string, defaultValue?: string) => Promise<string>;
|
|
9
10
|
export declare function runInitWizard(args: string[], options?: {
|
|
@@ -17,7 +18,34 @@ export declare function resolveSqlWriteDatabaseUrl(job: WritebackJob, configPath
|
|
|
17
18
|
export declare function verifyLocalWritebackAuthority(job: WritebackJob, configPath: string, storePath?: string, options?: {
|
|
18
19
|
cloudApproved?: boolean;
|
|
19
20
|
}): Promise<void>;
|
|
21
|
+
export declare function boundaryReviewCommand(args: string[]): Promise<number>;
|
|
22
|
+
export declare function boundaryActivateCommand(args: string[], schemaInspector?: typeof inspectDatabase): Promise<number>;
|
|
20
23
|
export declare function reconciliationSupportedOutcome(observation: ReconciliationObservation): "applied" | "conflict" | "failed";
|
|
21
24
|
export declare function reconciliationReceipt(intent: StoredWritebackIntent, observation: ReconciliationObservation, outcome: "applied" | "conflict" | "failed", runnerId: string, reason: string): ExecutionReceiptV2 | ExecutionReceiptV3 | ExecutionReceiptV4;
|
|
25
|
+
export declare function assertSupervisedPolicyApprovalCurrent(store: ProposalStore, config: RuntimeConfig, capability: RuntimeCapabilityConfig, proposal: StoredProposal): {
|
|
26
|
+
policy: string;
|
|
27
|
+
limits: PolicyApprovalLimit[];
|
|
28
|
+
} | undefined;
|
|
29
|
+
export type SupervisedWriterPostureAssessment = {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
fingerprint: `sha256:${string}`;
|
|
32
|
+
expected_fingerprint: `sha256:${string}` | null;
|
|
33
|
+
reasons: string[];
|
|
34
|
+
allowed_relations: string[];
|
|
35
|
+
writable_relations: string[];
|
|
36
|
+
};
|
|
37
|
+
export declare function assessSupervisedWriterPosture(config: RuntimeConfig, policy: RuntimeSupervisedWorkerCapabilityPolicy, inspection: SchemaInspection): SupervisedWriterPostureAssessment;
|
|
38
|
+
export declare function updateSupervisedProposalExpiryAttention(store: ProposalStore, config: RuntimeConfig, now?: string): void;
|
|
39
|
+
export declare function workbenchDeploymentProfileArg(args: string[]): WorkbenchDeploymentProfile | undefined;
|
|
40
|
+
export declare function databaseInputFromArgs(args: string[], options?: {
|
|
41
|
+
implyDatabaseUrl?: boolean;
|
|
42
|
+
}): {
|
|
43
|
+
explicit: boolean;
|
|
44
|
+
inlineUrl: boolean;
|
|
45
|
+
inspectionDatabaseUrlEnv: string;
|
|
46
|
+
configDatabaseUrlEnv: string;
|
|
47
|
+
env?: NodeJS.ProcessEnv;
|
|
48
|
+
};
|
|
49
|
+
export declare function runCliProcess(argv: string[]): Promise<number>;
|
|
22
50
|
export {};
|
|
23
51
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAaA,OAAO,EAAkgB,KAAK,WAAW,EAAuD,KAAK,uBAAuB,EAAE,KAAK,aAAa,EAAE,KAAK,uCAAuC,EAAoF,MAAM,6BAA6B,CAAC;AAItyB,OAAO,EAEL,aAAa,EAab,KAAK,mBAAmB,EAcxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAO3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAiL,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAqG,KAAK,YAAY,EAAwB,MAAM,2BAA2B,CAAC;AAEjb,OAAO,EAGL,eAAe,EAMf,KAAK,gBAAgB,EAEtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAcL,KAAK,yBAAyB,EAG/B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAOL,KAAK,0BAA0B,EAQhC,MAAM,eAAe,CAAC;AAwavB,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6E1D;AAwID,KAAK,SAAS,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9E,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,O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1,44 @@
|
|
|
1
1
|
import { type Server } from "node:http";
|
|
2
2
|
import { type ProposalFreshnessEvaluation } from "@synapsor-runner/mcp-server";
|
|
3
|
-
import { ProposalStore, type StoredProposal } from "@synapsor-runner/proposal-store";
|
|
3
|
+
import { ProposalStore, type StoredProposal, type WorkerControlAction } from "@synapsor-runner/proposal-store";
|
|
4
|
+
import { inspectDatabase } from "@synapsor-runner/schema-inspector";
|
|
5
|
+
import { type ExplorationBoundaryDraft } from "./auto-boundary.js";
|
|
6
|
+
import { createScopedExploreRuntime } from "./scoped-explore.js";
|
|
7
|
+
import { type AskProviderDependencies, type AskToolGateway } from "./model-ask.js";
|
|
4
8
|
type JsonRecord = Record<string, unknown>;
|
|
9
|
+
declare const BOUNDARY_REVIEW_PROGRESS_VERSION = "synapsor.boundary-review-progress.v2";
|
|
10
|
+
export type BoundaryReviewProgress = {
|
|
11
|
+
schema_version: typeof BOUNDARY_REVIEW_PROGRESS_VERSION;
|
|
12
|
+
revision: number;
|
|
13
|
+
draft_digest: `sha256:${string}`;
|
|
14
|
+
candidate: ExplorationBoundaryDraft;
|
|
15
|
+
candidate_digest: `sha256:${string}`;
|
|
16
|
+
confirmed_decisions: string[];
|
|
17
|
+
confirmations: BoundaryReviewConfirmation[];
|
|
18
|
+
invalidated_decisions: BoundaryReviewInvalidation[];
|
|
19
|
+
updated_at: string;
|
|
20
|
+
};
|
|
21
|
+
export type BoundaryReviewDecision = {
|
|
22
|
+
id: string;
|
|
23
|
+
kind: string;
|
|
24
|
+
decision: string;
|
|
25
|
+
input_digest: `sha256:${string}`;
|
|
26
|
+
resource_id?: string;
|
|
27
|
+
};
|
|
28
|
+
type BoundaryReviewConfirmation = BoundaryReviewDecision & {
|
|
29
|
+
status: "confirmed";
|
|
30
|
+
actor: string;
|
|
31
|
+
reason: string;
|
|
32
|
+
confirmed_at: string;
|
|
33
|
+
};
|
|
34
|
+
type BoundaryReviewInvalidation = {
|
|
35
|
+
id: string;
|
|
36
|
+
decision: string;
|
|
37
|
+
previous_input_digest: `sha256:${string}`;
|
|
38
|
+
current_input_digest?: `sha256:${string}`;
|
|
39
|
+
reason: "reviewed_input_changed" | "decision_removed";
|
|
40
|
+
invalidated_at: string;
|
|
41
|
+
};
|
|
5
42
|
export type LocalUiOptions = {
|
|
6
43
|
configPath?: string;
|
|
7
44
|
storePath?: string;
|
|
@@ -15,8 +52,88 @@ export type LocalUiOptions = {
|
|
|
15
52
|
projectRoot?: string;
|
|
16
53
|
storeAccess?: LocalUiStoreAccess;
|
|
17
54
|
safeActionPreview?: SafeActionPreview;
|
|
55
|
+
guidedActionPreview?: GuidedActionPreview;
|
|
18
56
|
freshnessEvaluator?: ProposalFreshnessEvaluator;
|
|
57
|
+
schemaInspector?: typeof inspectDatabase;
|
|
58
|
+
ledgerScope?: WorkbenchLedgerScope;
|
|
59
|
+
deploymentProfile?: WorkbenchDeploymentProfile;
|
|
60
|
+
proposalApprove?: WorkbenchProposalDecision;
|
|
61
|
+
proposalApply?: WorkbenchProposalDecision;
|
|
62
|
+
attentionAcknowledge?: WorkbenchAttentionDecision;
|
|
63
|
+
workerDecision?: WorkbenchWorkerDecision;
|
|
64
|
+
workerReconciliationInspect?: WorkbenchReconciliationInspect;
|
|
65
|
+
workerReconciliationResolve?: WorkbenchReconciliationResolve;
|
|
66
|
+
askGatewayFactory?: WorkbenchAskGatewayFactory;
|
|
67
|
+
askProviderDependencies?: AskProviderDependencies;
|
|
68
|
+
instantOnboarding?: boolean;
|
|
69
|
+
scopedExploreRuntimeFactory?: typeof createScopedExploreRuntime;
|
|
70
|
+
};
|
|
71
|
+
export type WorkbenchDeploymentProfile = "development" | "staging" | "production" | "unknown";
|
|
72
|
+
export type WorkbenchLedgerScope = {
|
|
73
|
+
tenant?: string;
|
|
74
|
+
principal?: string;
|
|
75
|
+
required?: boolean;
|
|
19
76
|
};
|
|
77
|
+
export type WorkbenchProposalDecision = (input: {
|
|
78
|
+
proposalId: string;
|
|
79
|
+
actor?: string;
|
|
80
|
+
reason?: string;
|
|
81
|
+
identityToken?: string;
|
|
82
|
+
}) => Promise<{
|
|
83
|
+
code: number;
|
|
84
|
+
}>;
|
|
85
|
+
export type WorkbenchAttentionDecision = (input: {
|
|
86
|
+
attentionId: string;
|
|
87
|
+
actor?: string;
|
|
88
|
+
identityToken?: string;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
code: number;
|
|
91
|
+
}>;
|
|
92
|
+
export type WorkbenchWorkerDecision = (input: {
|
|
93
|
+
action: WorkerControlAction | "cancel" | "dead_letter_requeue" | "dead_letter_discard";
|
|
94
|
+
capability?: string;
|
|
95
|
+
contractDigest?: `sha256:${string}`;
|
|
96
|
+
proposalId?: string;
|
|
97
|
+
retryBudget?: number;
|
|
98
|
+
actor?: string;
|
|
99
|
+
reason?: string;
|
|
100
|
+
identityToken?: string;
|
|
101
|
+
}) => Promise<{
|
|
102
|
+
code: number;
|
|
103
|
+
}>;
|
|
104
|
+
export type WorkbenchReconciliationView = {
|
|
105
|
+
intent_id: string;
|
|
106
|
+
proposal_id: string;
|
|
107
|
+
operation: string;
|
|
108
|
+
intent_status: string;
|
|
109
|
+
reconciliation_reason?: string;
|
|
110
|
+
classification: string;
|
|
111
|
+
supported_outcome: "applied" | "conflict" | "failed";
|
|
112
|
+
observed_digest: `sha256:${string}`;
|
|
113
|
+
expected_fields: string[];
|
|
114
|
+
observed_fields: string[];
|
|
115
|
+
member_count: number;
|
|
116
|
+
member_classifications: Record<string, number>;
|
|
117
|
+
source_database_changed: false;
|
|
118
|
+
};
|
|
119
|
+
export type WorkbenchReconciliationInspect = (input: {
|
|
120
|
+
intentId: string;
|
|
121
|
+
}) => Promise<WorkbenchReconciliationView>;
|
|
122
|
+
export type WorkbenchReconciliationResolve = (input: {
|
|
123
|
+
intentId: string;
|
|
124
|
+
outcome: "applied" | "conflict" | "failed";
|
|
125
|
+
actor?: string;
|
|
126
|
+
reason: string;
|
|
127
|
+
identityToken?: string;
|
|
128
|
+
}) => Promise<{
|
|
129
|
+
code: number;
|
|
130
|
+
}>;
|
|
131
|
+
export type WorkbenchAskGatewayFactory = (input: {
|
|
132
|
+
configPath: string;
|
|
133
|
+
storePath: string;
|
|
134
|
+
projectRoot: string;
|
|
135
|
+
env: NodeJS.ProcessEnv;
|
|
136
|
+
}) => Promise<AskToolGateway>;
|
|
20
137
|
export type SafeActionPreview = (input: {
|
|
21
138
|
projectRoot: string;
|
|
22
139
|
configPath: string;
|
|
@@ -28,6 +145,19 @@ export type SafeActionPreview = (input: {
|
|
|
28
145
|
proposal_hash: string;
|
|
29
146
|
source_database_changed: boolean;
|
|
30
147
|
}>;
|
|
148
|
+
export type GuidedActionPreview = (input: {
|
|
149
|
+
projectRoot: string;
|
|
150
|
+
configPath: string;
|
|
151
|
+
storePath: string;
|
|
152
|
+
capabilityName: string;
|
|
153
|
+
args: JsonRecord;
|
|
154
|
+
env: NodeJS.ProcessEnv;
|
|
155
|
+
}) => Promise<{
|
|
156
|
+
draft_digest: `sha256:${string}`;
|
|
157
|
+
proposal_id: string;
|
|
158
|
+
proposal_hash: string;
|
|
159
|
+
source_database_changed: boolean;
|
|
160
|
+
}>;
|
|
31
161
|
export type ProposalFreshnessEvaluator = (proposal: StoredProposal) => Promise<ProposalFreshnessEvaluation>;
|
|
32
162
|
export type LocalUiStoreAccess = <T>(mode: "read" | "write", operation: string, callback: (store: ProposalStore) => T) => Promise<T>;
|
|
33
163
|
export type LocalUiServer = {
|
|
@@ -40,5 +170,19 @@ export type LocalUiServer = {
|
|
|
40
170
|
close: () => Promise<void>;
|
|
41
171
|
};
|
|
42
172
|
export declare function startLocalUiServer(options?: LocalUiOptions): Promise<LocalUiServer>;
|
|
173
|
+
export declare function recommendedWorkbenchCandidate(draft: ExplorationBoundaryDraft, maximumResources?: number): ExplorationBoundaryDraft;
|
|
174
|
+
export declare function instantWorkbenchCandidate(draft: ExplorationBoundaryDraft): ExplorationBoundaryDraft;
|
|
175
|
+
export declare function readBoundaryReviewProgress(projectRoot: string, draft: ExplorationBoundaryDraft): Promise<BoundaryReviewProgress | undefined>;
|
|
176
|
+
export declare function createBoundaryReviewProgress(input: {
|
|
177
|
+
draft: ExplorationBoundaryDraft;
|
|
178
|
+
candidate: ExplorationBoundaryDraft;
|
|
179
|
+
confirmedDecisions: string[];
|
|
180
|
+
previous?: BoundaryReviewProgress;
|
|
181
|
+
actor?: string;
|
|
182
|
+
revision: number;
|
|
183
|
+
now?: string;
|
|
184
|
+
}): BoundaryReviewProgress;
|
|
185
|
+
export declare function saveBoundaryReviewProgress(projectRoot: string, progress: BoundaryReviewProgress): Promise<void>;
|
|
186
|
+
export declare function boundaryReviewDecisions(candidate: ExplorationBoundaryDraft): BoundaryReviewDecision[];
|
|
43
187
|
export {};
|
|
44
188
|
//# sourceMappingURL=local-ui.d.ts.map
|
package/dist/local-ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-ui.d.ts","sourceRoot":"","sources":["../src/local-ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAIjG,OAAO,EAAmG,KAAK,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAChL,OAAO,
|
|
1
|
+
{"version":3,"file":"local-ui.d.ts","sourceRoot":"","sources":["../src/local-ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAIjG,OAAO,EAAmG,KAAK,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAChL,OAAO,EACL,aAAa,EAQb,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAEzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGpE,OAAO,EAcL,KAAK,wBAAwB,EAE9B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EACL,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAgC7B,OAAO,EAKL,KAAK,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