---
title: Pinned Finance Core runtime resources
description: Execute the fixed binary diagnostic profile in a trusted Computer host.
owner: engineering
sourceFiles:
  - packages/finance-core-runtime/package.json
  - packages/finance-core-runtime/source-manifest.json
  - packages/finance-core-runtime/protocol.json
  - packages/finance-core-runtime/runtime/diagnostic.py
  - packages/finance-core-runtime/src/verify.ts
  - packages/finance-core-runtime/src/probe.ts
  - packages/finance-core-runtime/tests/test_diagnostic.py
  - .github/workflows/ci.yml
---

`@workbench/finance-core-runtime` supplies four pinned source files and a fixed binary `captured-source-diagnostic` runner. Run its [local verification and probe](/reference/cli#finance-core-runtime-resources) before incorporating the package into a trusted Computer image. This resource package is not an installed Computer service or a completed Finance workflow.

## Provenance and packaging

The private workspace preserves exactly four files from `CreditWurthy/finance-core` revision `80355525512bbcde30703ff8f702caa63332190f`, version `0.2.0-preparation.2`:

- `scripts/finance_core.py`
- `scripts/financial_jobs.py`
- `upstream/ledger-goblins/scripts/qbo-diagnostic-metrics`
- `upstream/ledger-goblins/.agents/skills/customer-diagnostic-report/assets/grade-from-rubric.py`

Their relative paths and original bytes are retained under `resources/`. The manifest records each SHA-256, the runner, protocol and dependency-requirements hashes, and an aggregate package digest. It covers the sorted source path/hash lines (path, NUL, hash, newline), followed by the runner, protocol and requirements hashes, each with a newline. Verification rejects missing, extra, changed or symlinked resources. Offline preparation reads only those immutable Git objects from a supplied checkout; it never fetches a branch. Python dependencies have hash-pinned wheels in `requirements.txt`; the runner also rejects missing or mismatched installed versions.

Exports `./manifest`, `./protocol` and `./runner` let the host locate the committed resources and shared limits. The runtime owner must copy the package's `resources/`, `runtime/`, manifest, protocol and requirements into the approved image, make them read-only, install the pinned dependencies and call the runner with its trusted interpreter. No private GitHub checkout, repository credential or whole Finance Core application is required at runtime.

## Trusted request boundary

The runner reads one UTF-8 JSON request from stdin and writes one JSON success or explicit failure. It accepts no arbitrary program, script, argv, output filename or source path.

| Field | Required meaning |
| --- | --- |
| `protocol`, `packageDigest` | Exact committed protocol and expected package digest |
| `originalActor` | Authenticated `userId` and original `activeOrganizationId` |
| `scope` | Server-derived `firmId`, `clientId`, `spaceId`, `itemId`, `runId` |
| `allowedCapabilities` | Exactly `['captured-source-diagnostic']` |
| `asOf` | Canonical last day of a completed reporting month |
| `reports` | Exactly `trial_balance`, `account_list`, `profit_and_loss_by_month`, `transaction_list_by_date`, `journal` |
| `observations` | An explicit observation JSON capture; missing facts are not defaulted clean |

Each capture supplies `fileId`, `immutableVersion`, `sha256`, canonical `base64` bytes, `firmId`, `clientId`, `spaceId`, `asOf`, `currency: USD` and `basis: accrual`. Report captures also declare their matching `exportType` and `coverage: complete`. Hashes establish the bytes used; these metadata declarations do not establish completeness, financial truth or current access. Duplicate file/version pairs, unknown fields, duplicate JSON keys and cross-scope captures are rejected. Temporary snapshot paths are generated by the runner, never taken from source identifiers.

The original actor's active organization is separate from firm ownership. The host must derive scope through the authorized conversation and immutable business/space binding, load each exact file version under current grants, and recheck authority at execution and save. An agent must not construct its own trusted identity or grant object.

## Shared bounds and execution

`protocol.json` is the public constants source for the runner and future Computer caller. These conservative first-cut limits are product limits, not claims about the Computer SDK's maximum capacity.

| Resource | Bound |
| --- | --- |
| One decoded capture | 4 MiB |
| All six decoded captures combined | 4 MiB |
| Entire encoded UTF-8 request, including base64 and metadata | 6 MiB |
| Result stdout / child stderr | 4 MiB / 64 KiB |
| Child wall time / CPU time | 90 seconds / 60 seconds |
| Required outer Computer execution budget | 100 seconds |

The subprocess gets a controlled environment, isolated Python imports, read-only source copies and fixed CLI arguments. A root container supervisor drops child identity to UID/GID 65534; a non-root local probe retains its existing developer identity. Descendants are killed on completion, timeout or interruption. Output is drained with separate stdout/stderr bounds. Temporary captures are removed. The Computer host still owns network/operating-system isolation and durable run claims; this process wrapper is not a sandbox or authentication service. Unknown execution outcomes must not be automatically retried.

Only the supported USD/accrual, full-month five-report XLSX profile with explicitly empty AR/AP is accepted. Workbook shape, report controls, dates and observations pass through the original pinned Core validation. Larger captures, other currencies/bases, arbitrary exports, nonzero AR/AP or absent observations must block and request supported evidence. The runner never normalizes or truncates them to manufacture a result.

## Draft output and acceptance

A successful envelope contains actual UTF-8 `diagnostic.md` and `diagnostic.json` artifacts, verified hashes, captured metrics and grades, and Core's separate preparation, approval and delivery states. The runner checks source attribution, period, draft qualification, absence of effects and conflicting nested item/run identity. Its `provenance` retains the original actor, complete host scope, package digest and immutable source references without copying base64 into the receipt. `persistence: not_saved` is explicit. Preserve this receipt with the bytes; upstream standalone artifacts identify client/space while full item/run attribution belongs to the validated host envelope.

Failure envelopes have `ok: false` and a public error code: `INVALID_INPUT`, `INPUT_LIMIT`, `SOURCE_CHANGED`, `SCOPE_DENIED`, `UNSUPPORTED_PROFILE`, `PACKAGE_MISMATCH`, `CORE_FAILURE`, `OUTPUT_LIMIT`, `TIMED_OUT`, `EXECUTION_FAILED` or `INVALID_RESULT`. Core rejections retain `coreCode`; no partial draft is accepted and raw process errors are not exposed.

The real subprocess tests use invented binary captures, verify twelve-month income `6000`, expenses `1200`, one transaction and actual JSON artifact values, and require deterministic results. Distinct failure cases protect byte/scope binding, binary/envelope limits, fixed-program selection, missing observations/nonzero AR, unsupported profiles, ambient imports and resource injection. The existing CI Tests job runs them with a dedicated hash-pinned Python environment.

Hosted Computer execution, authoritative file loading, canonical draft save/append, recovery and later publication remain separate integration work. The file owner's XLSX/JSON support and its R2 deployment credential gate are operational dependencies; this package changes neither credentials nor infrastructure. Phil/Tara's agreed financial case, period, expected findings and reviewer remain acceptance inputs. Synthetic execution does not verify live QBO data or replace their review.
