@crewhaus/target-onchain 0.1.7 → 0.2.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/dist/index.d.ts +2 -2
- package/dist/index.js +9 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
* slice) boots the bundle against an in-process anvil fork.
|
|
34
34
|
*/
|
|
35
35
|
import { CrewhausError } from "@crewhaus/errors";
|
|
36
|
-
import type
|
|
36
|
+
import { type Bundle, type EmitReadmeOptions, type IrChainV0 } from "@crewhaus/ir";
|
|
37
37
|
export declare class TargetEmitError extends CrewhausError {
|
|
38
38
|
readonly name = "TargetEmitError";
|
|
39
39
|
constructor(message: string, cause?: unknown);
|
|
40
40
|
}
|
|
41
|
-
export declare function emitOnchain(ir: IrChainV0): Bundle;
|
|
41
|
+
export declare function emitOnchain(ir: IrChainV0, opts?: EmitReadmeOptions): Bundle;
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { CrewhausError } from "@crewhaus/errors";
|
|
36
36
|
import { escapeJsonString } from "@crewhaus/infra-utils";
|
|
37
|
+
import { renderBundleReadme, } from "@crewhaus/ir";
|
|
37
38
|
export class TargetEmitError extends CrewhausError {
|
|
38
39
|
name = "TargetEmitError";
|
|
39
40
|
constructor(message, cause) {
|
|
@@ -107,7 +108,7 @@ function renderTrigger(t) {
|
|
|
107
108
|
}
|
|
108
109
|
return ` { kind: "address", chainId: ${JSON.stringify(t.chainId)}, address: ${JSON.stringify(t.address)}, direction: ${JSON.stringify(t.direction)} }`;
|
|
109
110
|
}
|
|
110
|
-
export function emitOnchain(ir) {
|
|
111
|
+
export function emitOnchain(ir, opts = {}) {
|
|
111
112
|
if (ir.chains.length === 0) {
|
|
112
113
|
throw new TargetEmitError("onchain target requires at least one chain binding");
|
|
113
114
|
}
|
|
@@ -209,5 +210,11 @@ export async function acceptOrRedact(payload: string): Promise<{ accept: boolean
|
|
|
209
210
|
// the structured payload directly. Until then, the emitted bundle is a
|
|
210
211
|
// callable module that downstream daemons or tests import.
|
|
211
212
|
`;
|
|
212
|
-
|
|
213
|
+
const files = [{ path: "agent.ts", content }];
|
|
214
|
+
// Item 42 — generated bundle README; default ON (`crewhaus compile
|
|
215
|
+
// --no-readme` opts out).
|
|
216
|
+
if (opts.readme !== false) {
|
|
217
|
+
files.push({ path: "README.md", content: renderBundleReadme(ir) });
|
|
218
|
+
}
|
|
219
|
+
return { files };
|
|
213
220
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/target-onchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Codegen for the §47 `onchain` event-driven daemon. Emits a self-contained agent.ts that subscribes to chain triggers, classifies inbound events, dedupes by tx-hash + log-index, and runs one agent turn per event.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"test": "bun test src"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@crewhaus/errors": "0.
|
|
19
|
-
"@crewhaus/infra-utils": "0.
|
|
20
|
-
"@crewhaus/ir": "0.
|
|
18
|
+
"@crewhaus/errors": "0.2.0",
|
|
19
|
+
"@crewhaus/infra-utils": "0.2.0",
|
|
20
|
+
"@crewhaus/ir": "0.2.0"
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"author": {
|