@synapsor/runner 1.5.0 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -3
- package/README.md +96 -109
- package/dist/authoring.d.ts +23 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.mjs +1318 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -5
- package/dist/local-ui.d.ts +14 -0
- package/dist/local-ui.d.ts.map +1 -1
- package/dist/runner.mjs +10845 -5598
- package/dist/runtime.mjs +29 -1
- package/dist/shadow.d.ts +36 -0
- package/dist/shadow.d.ts.map +1 -0
- package/dist/shadow.mjs +5262 -0
- package/docs/README.md +25 -2
- package/docs/alternatives.md +122 -0
- package/docs/capability-authoring.md +43 -0
- package/docs/client-recipes.md +218 -0
- package/docs/contract-testing.md +9 -7
- package/docs/cursor-plugin.md +78 -0
- package/docs/effect-regression.md +39 -2
- package/docs/fresh-developer-usability.md +110 -0
- package/docs/getting-started-own-database.md +96 -2
- package/docs/host-compatibility.md +59 -0
- package/docs/local-mode.md +6 -5
- package/docs/mcp-audit.md +166 -2
- package/docs/mcp-client-setup.md +4 -0
- package/docs/mcp-clients.md +33 -4
- package/docs/oss-vs-cloud.md +3 -0
- package/docs/release-notes.md +90 -4
- package/docs/security-boundary.md +20 -5
- package/docs/shadow-studies.md +47 -4
- package/docs/troubleshooting-first-run.md +46 -0
- package/examples/support-billing-agent/README.md +18 -0
- package/examples/support-billing-agent/app/README.md +6 -0
- package/examples/support-billing-agent/app/contract.ts +28 -0
- package/examples/support-billing-agent/app/effect-adapter.mjs +23 -0
- package/examples/support-billing-agent/app/record-shadow-outcomes.mjs +44 -0
- package/examples/support-billing-agent/scripts/run-evaluation.sh +6 -5
- package/examples/support-plan-credit/README.md +48 -2
- package/examples/support-plan-credit/mcp-client-examples/README.md +23 -0
- package/examples/support-plan-credit/mcp-client-examples/claude-code.sh +34 -0
- package/examples/support-plan-credit/mcp-client-examples/codex.config.toml +24 -0
- package/examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs +35 -0
- package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs +31 -0
- package/examples/support-plan-credit/mcp-client-examples/google-adk.py +40 -0
- package/examples/support-plan-credit/mcp-client-examples/langchain.mjs +29 -0
- package/examples/support-plan-credit/mcp-client-examples/llamaindex.py +36 -0
- package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +1 -1
- package/examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts +1 -1
- package/examples/support-plan-credit/mcp-client-examples/vscode.mcp.json +20 -0
- package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.contract-tests.generated.json +221 -0
- package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.ts +34 -0
- package/fixtures/mcp-audit/README.md +14 -0
- package/fixtures/mcp-audit/cursor-bypass-config.json +38 -0
- package/fixtures/mcp-audit/dangerous-tools-list.json +33 -0
- package/fixtures/mcp-audit/reviewed-proposal-tools-list.json +60 -0
- package/package.json +18 -3
- package/schemas/mcp-audit-report.schema.json +100 -1
- package/schemas/synapsor.contract-tests.schema.json +1 -1
package/dist/runtime.mjs
CHANGED
|
@@ -6327,6 +6327,7 @@ var ProposalStore = class {
|
|
|
6327
6327
|
const highestRisk = comparisons.filter((item) => item.status === "disagreement" || item.status === "partial_agreement" || item.status === "invalid_or_unsafe_scope_attempt").sort(
|
|
6328
6328
|
(left, right) => (right.risk_score ?? 0) - (left.risk_score ?? 0) || (right.amount_value ?? 0) - (left.amount_value ?? 0) || left.case_id.localeCompare(right.case_id)
|
|
6329
6329
|
).slice(0, 10);
|
|
6330
|
+
const suggestedPolicies = suggestedShadowPolicies(comparisons);
|
|
6330
6331
|
return {
|
|
6331
6332
|
study,
|
|
6332
6333
|
total_tasks_observed: comparisons.length,
|
|
@@ -6345,7 +6346,8 @@ var ProposalStore = class {
|
|
|
6345
6346
|
by_capability: byCapability,
|
|
6346
6347
|
by_decision_reason: byDecisionReason,
|
|
6347
6348
|
highest_risk_disagreements: highestRisk,
|
|
6348
|
-
suggested_policies:
|
|
6349
|
+
suggested_policies: suggestedPolicies,
|
|
6350
|
+
trust_progression: shadowTrustProgression(comparisons, suggestedPolicies),
|
|
6349
6351
|
comparisons,
|
|
6350
6352
|
generated_at: latestIsoTimestamp([
|
|
6351
6353
|
study.updated_at,
|
|
@@ -7829,6 +7831,32 @@ function suggestedShadowPolicies(comparisons) {
|
|
|
7829
7831
|
}
|
|
7830
7832
|
return suggestions;
|
|
7831
7833
|
}
|
|
7834
|
+
function shadowTrustProgression(comparisons, suggestions) {
|
|
7835
|
+
const outcomes = comparisons.filter((item) => item.outcome !== void 0).length;
|
|
7836
|
+
const comparable = comparisons.filter((item) => item.comparable).length;
|
|
7837
|
+
const exact = comparisons.filter((item) => item.status === "exact_agreement").length;
|
|
7838
|
+
const currentStage = comparisons.length === 0 ? "observe" : outcomes === 0 ? "compare" : suggestions.length === 0 ? "manual_review" : "suggested_bounded_policy";
|
|
7839
|
+
const stageOrder = ["observe", "compare", "manual_review", "suggested_bounded_policy"];
|
|
7840
|
+
const currentIndex = stageOrder.indexOf(currentStage);
|
|
7841
|
+
const details = {
|
|
7842
|
+
observe: `${comparisons.length} task${comparisons.length === 1 ? "" : "s"} observed without source mutation.`,
|
|
7843
|
+
compare: `${outcomes} authoritative outcome${outcomes === 1 ? "" : "s"}; ${comparisons.length - outcomes} unmatched.`,
|
|
7844
|
+
manual_review: `${comparable} comparable task${comparable === 1 ? "" : "s"}; ${exact} exact agreement${exact === 1 ? "" : "s"}. At least 5 exact numeric examples are required before a bounded-policy suggestion.`,
|
|
7845
|
+
suggested_bounded_policy: suggestions.length > 0 ? `${suggestions.length} inactive bounded-policy suggestion${suggestions.length === 1 ? "" : "s"}; a human must review and activate any contract change separately.` : "No policy suggestion is available."
|
|
7846
|
+
};
|
|
7847
|
+
const labels = ["Observe", "Compare", "Manual review", "Suggested bounded policy"];
|
|
7848
|
+
return {
|
|
7849
|
+
current_stage: currentStage,
|
|
7850
|
+
minimum_policy_sample_size: 5,
|
|
7851
|
+
insufficient_sample_size: suggestions.length === 0,
|
|
7852
|
+
stages: stageOrder.map((stage, index) => ({
|
|
7853
|
+
name: labels[index],
|
|
7854
|
+
status: index < currentIndex ? "complete" : index === currentIndex ? "current" : "locked",
|
|
7855
|
+
detail: details[stage]
|
|
7856
|
+
})),
|
|
7857
|
+
automatic_activation: false
|
|
7858
|
+
};
|
|
7859
|
+
}
|
|
7832
7860
|
function safeSqliteFailure(_error, fallback) {
|
|
7833
7861
|
return fallback;
|
|
7834
7862
|
}
|
package/dist/shadow.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ShadowEffect, type ShadowOutcomeDisposition, type StoredShadowOutcome } from "@synapsor-runner/proposal-store";
|
|
2
|
+
export type AuthoritativeShadowOutcome = {
|
|
3
|
+
requestId: string;
|
|
4
|
+
proposalId?: string;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
businessObject: string;
|
|
7
|
+
objectId: string;
|
|
8
|
+
disposition: ShadowOutcomeDisposition;
|
|
9
|
+
actualEffect?: ShadowEffect;
|
|
10
|
+
occurredAt?: string;
|
|
11
|
+
reference?: string;
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ShadowOutcomeRecorder = {
|
|
15
|
+
record(outcome: AuthoritativeShadowOutcome): StoredShadowOutcome;
|
|
16
|
+
close(): void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Records trusted application outcomes directly in Runner's local shadow
|
|
20
|
+
* ledger. This helper never reads or mutates the application's source data.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createShadowOutcomeRecorder(input: {
|
|
23
|
+
storePath: string;
|
|
24
|
+
studyId: string;
|
|
25
|
+
actor: string;
|
|
26
|
+
source: string;
|
|
27
|
+
}): ShadowOutcomeRecorder;
|
|
28
|
+
export declare function recordAuthoritativeShadowOutcome(input: {
|
|
29
|
+
storePath: string;
|
|
30
|
+
studyId: string;
|
|
31
|
+
actor: string;
|
|
32
|
+
source: string;
|
|
33
|
+
outcome: AuthoritativeShadowOutcome;
|
|
34
|
+
}): StoredShadowOutcome;
|
|
35
|
+
export type { ShadowEffect, ShadowOutcomeDisposition, StoredShadowOutcome, } from "@synapsor-runner/proposal-store";
|
|
36
|
+
//# sourceMappingURL=shadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../src/shadow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE5I,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,wBAAwB,CAAC;IACtC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAAC;IACjE,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CA+BxB;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,0BAA0B,CAAC;CACrC,GAAG,mBAAmB,CAOtB;AAED,YAAY,EACV,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC"}
|