car-runtime 0.24.1 → 0.25.0
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/index.d.ts +154 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1548,6 +1548,15 @@ export function a2aServerStatus(): string;
|
|
|
1548
1548
|
* `JSON.stringify([{ name: "echo", parameters: { type: "object",
|
|
1549
1549
|
* properties: { msg: { type: "string" } }, required: ["msg"] } }])`.
|
|
1550
1550
|
* When both are given, `toolSchemasJson` takes precedence.
|
|
1551
|
+
*
|
|
1552
|
+
* Returns a JSON string:
|
|
1553
|
+
* `{ valid, issues, simulated_state, execution_levels, conflicts,
|
|
1554
|
+
* evidence }`. `evidence` is the verifier's declared scope (survey
|
|
1555
|
+
* "Code as Agent Harness" §5.2.2): `{ checks: [{ name, ran, verifies,
|
|
1556
|
+
* cannot_verify, findings }], assumptions, untested_regions,
|
|
1557
|
+
* residual_risks, confidence }` — so a `valid: true` verdict can be read
|
|
1558
|
+
* with its scope (what was checked, what was not, coverage confidence)
|
|
1559
|
+
* rather than as a blanket guarantee.
|
|
1551
1560
|
*/
|
|
1552
1561
|
export function verify(
|
|
1553
1562
|
proposalJson: string,
|
|
@@ -1566,6 +1575,151 @@ export function optimize(proposalJson: string): string;
|
|
|
1566
1575
|
|
|
1567
1576
|
export function equivalent(proposal1Json: string, proposal2Json: string): boolean;
|
|
1568
1577
|
|
|
1578
|
+
/**
|
|
1579
|
+
* Check a proposal for transactional conflicts against the current shared
|
|
1580
|
+
* state (survey "Code as Agent Harness" §4.3/§5.2.4 — the shared
|
|
1581
|
+
* code-centric harness substrate). `versionsJson` is a JSON object mapping
|
|
1582
|
+
* state key → current version (from the runtime's versioned state store);
|
|
1583
|
+
* `stateJson` (optional) maps key → current value for value-level
|
|
1584
|
+
* assumption checks.
|
|
1585
|
+
*
|
|
1586
|
+
* Returns the `TransactionReport` JSON: `{ consistent: boolean, conflicts:
|
|
1587
|
+
* [{ kind, key, actions, explanation, resolution }] }` where `kind` is
|
|
1588
|
+
* `"write_write" | "read_write" | "stale_assumption"`. Detects write-write
|
|
1589
|
+
* races and read-write hazards between unordered actions, and stale
|
|
1590
|
+
* assumptions (an action planned against a key at a version/value the
|
|
1591
|
+
* shared state has since moved past — belief divergence). Each conflict
|
|
1592
|
+
* carries a human-actionable explanation and a suggested resolution.
|
|
1593
|
+
*/
|
|
1594
|
+
export function transactionCheck(
|
|
1595
|
+
proposalJson: string,
|
|
1596
|
+
versionsJson?: string | null,
|
|
1597
|
+
stateJson?: string | null,
|
|
1598
|
+
): string;
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Compute harness-level evaluation metrics (survey "Code as Agent Harness"
|
|
1602
|
+
* §5.2.1) from a JSONL tail of a session's event log (one event per line).
|
|
1603
|
+
* Returns the `HarnessMetrics` JSON with six operational-substrate
|
|
1604
|
+
* dimensions — `trajectory_efficiency` (actions, tokens, cost, wall-clock,
|
|
1605
|
+
* success_rate), `verification_strength` (validated/rejected, rejection_rate),
|
|
1606
|
+
* `recovery` (replans, branch decisions, rejected alternatives),
|
|
1607
|
+
* `state_consistency` (changes, snapshots, rollbacks), `safety`
|
|
1608
|
+
* (permission escalations/denials/approvals), and `replayability` — to
|
|
1609
|
+
* complement task-success accuracy when comparing harness variants.
|
|
1610
|
+
*/
|
|
1611
|
+
export function harnessMetrics(eventsJsonl: string): string;
|
|
1612
|
+
|
|
1613
|
+
// --- Agentic Harness Engineering: Evolution Agent (survey §3.5, §5.2.3) ---
|
|
1614
|
+
//
|
|
1615
|
+
// A governed meta-agent that proposes harness mutations from telemetry and
|
|
1616
|
+
// gates their adoption. Every mutation carries a change contract; promotion
|
|
1617
|
+
// is regression-gated; safety-affecting changes require human approval.
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* Diagnose harness telemetry into governed mutation proposals. `metricsJson`
|
|
1621
|
+
* is a `HarnessMetrics` (from {@link harnessMetrics}); `configJson`
|
|
1622
|
+
* optionally overrides the diagnosis thresholds. Returns a JSON array of
|
|
1623
|
+
* `HarnessMutation`, each `{ id, rationale, contract: { component,
|
|
1624
|
+
* target_failure, predicted_improvement, invariants, falsifying_eval,
|
|
1625
|
+
* rollback } }`. Nothing is applied — proposals must pass
|
|
1626
|
+
* {@link evolutionEvaluate} and, when safety-affecting, human approval.
|
|
1627
|
+
*/
|
|
1628
|
+
export function evolutionDiagnose(
|
|
1629
|
+
metricsJson: string,
|
|
1630
|
+
configJson?: string | null,
|
|
1631
|
+
): string;
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Regression-gate a candidate harness mutation. `mutationJson` is a
|
|
1635
|
+
* `HarnessMutation`; `baselineJson`/`candidateJson` are `HarnessMetrics`
|
|
1636
|
+
* measured before/after applying it on held-out telemetry. Returns the
|
|
1637
|
+
* `PromotionDecision` JSON `{ decision: "promote" | "needs_approval" |
|
|
1638
|
+
* "reject", reason }` — a mutation is promoted only if its target improved
|
|
1639
|
+
* without regressing guarded metrics; safety-affecting mutations route to
|
|
1640
|
+
* `needs_approval` even when they pass.
|
|
1641
|
+
*/
|
|
1642
|
+
export function evolutionEvaluate(
|
|
1643
|
+
mutationJson: string,
|
|
1644
|
+
baselineJson: string,
|
|
1645
|
+
candidateJson: string,
|
|
1646
|
+
configJson?: string | null,
|
|
1647
|
+
): string;
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Apply a mutation's concrete patch to a `HarnessConfig` under governed
|
|
1651
|
+
* authorization (survey §3.5/§5.2.3). `humanApproved=true` applies under the
|
|
1652
|
+
* HITL path — the only path that may land a safety-affecting mutation;
|
|
1653
|
+
* otherwise `decisionJson` (a `PromotionDecision`) must be `promote` and the
|
|
1654
|
+
* mutation must be non-safety. Returns `{ config, rollback }` (the updated
|
|
1655
|
+
* config and the inverse patch that restores it), or throws when refused.
|
|
1656
|
+
*/
|
|
1657
|
+
export function evolutionApply(
|
|
1658
|
+
configJson: string,
|
|
1659
|
+
mutationJson: string,
|
|
1660
|
+
decisionJson?: string | null,
|
|
1661
|
+
humanApproved?: boolean,
|
|
1662
|
+
): string;
|
|
1663
|
+
|
|
1664
|
+
// --- Permission-tier gate (survey "Code as Agent Harness" §3.4.3, §5.2.5) ---
|
|
1665
|
+
//
|
|
1666
|
+
// The harness as safety governor: classify each action's risk tier
|
|
1667
|
+
// (read_only | sandbox_edit | full_access), gate it against the session's
|
|
1668
|
+
// granted standing tier, and record human-in-the-loop approvals as durable,
|
|
1669
|
+
// auditable state (a JSONL ledger keyed by a stable action fingerprint).
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* Classify each action in a proposal into its minimum required permission
|
|
1673
|
+
* tier. Returns a JSON array of `{ action_id, tool, required_tier }` where
|
|
1674
|
+
* `required_tier` is `"read_only" | "sandbox_edit" | "full_access"`.
|
|
1675
|
+
*/
|
|
1676
|
+
export function permissionClassify(proposalJson: string): string;
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Evaluate each action against a granted standing tier, consulting the
|
|
1680
|
+
* durable approval ledger JSONL at `ledgerPath` when supplied. Returns a
|
|
1681
|
+
* JSON array of per-action decisions, each `{ decision, required, granted,
|
|
1682
|
+
* action_id, fingerprint, ... }` where `decision` is `"allow" |
|
|
1683
|
+
* "needs_approval" | "deny"`. A `needs_approval` decision means autonomy is
|
|
1684
|
+
* suspended pending a human decision; resolve it with
|
|
1685
|
+
* {@link permissionRecordForFingerprint}.
|
|
1686
|
+
*/
|
|
1687
|
+
export function permissionEvaluate(
|
|
1688
|
+
proposalJson: string,
|
|
1689
|
+
grantedTier: string,
|
|
1690
|
+
ledgerPath?: string | null,
|
|
1691
|
+
): string;
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Record a durable human-in-the-loop approval (`approve=true`) or rejection
|
|
1695
|
+
* for the operation an action represents, appending it to the JSONL ledger
|
|
1696
|
+
* at `ledgerPath`. The decision persists and overrides future evaluations
|
|
1697
|
+
* of the same operation. Returns the stored approval record JSON.
|
|
1698
|
+
*/
|
|
1699
|
+
export function permissionRecordDecision(
|
|
1700
|
+
actionJson: string,
|
|
1701
|
+
approve: boolean,
|
|
1702
|
+
reviewer: string,
|
|
1703
|
+
reason: string,
|
|
1704
|
+
evidence: string | undefined | null,
|
|
1705
|
+
ledgerPath: string,
|
|
1706
|
+
): string;
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Like {@link permissionRecordDecision} but keyed by an explicit
|
|
1710
|
+
* `fingerprint` (from a prior `needs_approval` decision) with an annotating
|
|
1711
|
+
* `requiredTier`. Returns the stored approval record JSON.
|
|
1712
|
+
*/
|
|
1713
|
+
export function permissionRecordForFingerprint(
|
|
1714
|
+
fingerprint: string,
|
|
1715
|
+
requiredTier: string,
|
|
1716
|
+
approve: boolean,
|
|
1717
|
+
reviewer: string,
|
|
1718
|
+
reason: string,
|
|
1719
|
+
evidence: string | undefined | null,
|
|
1720
|
+
ledgerPath: string,
|
|
1721
|
+
): string;
|
|
1722
|
+
|
|
1569
1723
|
// --- Multi-agent coordination ---
|
|
1570
1724
|
|
|
1571
1725
|
/**
|