stdio transport only - no HTTP listener, no Provider, no outbound network.
Wires together decode.ts/policy.ts/sign.ts/audit.ts/keysource.ts (Tasks 2-6)
behind four tools: vector_signer_get_address, vector_signer_decode_transaction,
vector_signer_sign, vector_signer_get_spend_limits.
Two corrections needed beyond the brief's given code to reach its own stated
"pass 9, fail 0" outcome, both verified necessary by reproducing the failure
first:
- packages/signer/tsup.config.ts: target bumped es2020 -> es2022. index.ts's
top-level `await server.connect(...)` is ES2022 syntax; esbuild hard-errors
("Top-level await is not available in the configured target environment")
under the package's original es2020 target rather than attempting an unsafe
downlevel transform. Scoped to the signer package only - the builder never
uses top-level await and its own tsup.config.ts is untouched.
- tools.ts's decode_transaction response text: "(not signed)" and "would be
signed" both contain the substring "signed", which collides with this same
smoke test's own `!/signed/i.test(text)` check on every call, including the
refused case. Reworded to "(read-only)" / "would be ALLOWED" - same meaning,
no collision. Fixed the response text rather than loosening the test, which
stays exactly as given.
Brief's own smoke test (9 tests) passes verbatim. Workspace-wide: typecheck 0,
test:unit 180/180 (no regressions), builder test:smoke still 26/23/0.
The audit-append-failure handling required by the task (a produced signature
must never be released if its audit record fails to write) is not yet in this
commit - see the follow-up commit.
21 lines
878 B
TypeScript
21 lines
878 B
TypeScript
import { defineConfig } from "tsup";
|
|
|
|
export default defineConfig({
|
|
entry: ["src/index.ts"],
|
|
format: ["esm"],
|
|
// es2022, not es2020 (Task 1's original value): index.ts uses a top-level
|
|
// `await server.connect(...)` (brief's own given code, Task 7), and
|
|
// top-level await is an ES2022 language feature — esbuild hard-errors
|
|
// ("Top-level await is not available in the configured target environment")
|
|
// rather than attempting an unsafe downlevel transform, unlike most other
|
|
// modern syntax. Node 22 (this package's engines.node floor) natively
|
|
// supports it. Scoped to the signer package only; the builder's own
|
|
// tsup.config.ts is untouched because vector.ts/index.ts never uses
|
|
// top-level await and has no need for the bump.
|
|
target: "es2022",
|
|
outDir: "build",
|
|
clean: true,
|
|
splitting: false,
|
|
banner: { js: "#!/usr/bin/env node" },
|
|
});
|