@acpfx/echo 0.2.2 → 0.2.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/LICENSE +15 -0
- package/README.md +25 -0
- package/dist/index.js +138 -0
- package/dist/manifest.json +1 -0
- package/package.json +6 -2
- package/CHANGELOG.md +0 -38
- package/src/index.ts +0 -24
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 acpfx contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @acpfx/echo
|
|
2
|
+
|
|
3
|
+
Echoes all received events back. A passthrough node useful for testing and debugging pipeline wiring.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
This package is a pipeline node for [@acpfx/cli](../orchestrator/README.md). See the CLI package for installation and usage.
|
|
8
|
+
|
|
9
|
+
## Manifest
|
|
10
|
+
|
|
11
|
+
- **Consumes:** all event types
|
|
12
|
+
- **Emits:** all event types (mirrors input)
|
|
13
|
+
|
|
14
|
+
## Pipeline Example
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
nodes:
|
|
18
|
+
echo:
|
|
19
|
+
use: "@acpfx/echo"
|
|
20
|
+
outputs: [recorder]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
ISC
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// ../node-sdk/src/index.ts
|
|
2
|
+
import { createInterface } from "node:readline";
|
|
3
|
+
|
|
4
|
+
// ../core/src/config.ts
|
|
5
|
+
import { parse as parseYaml } from "yaml";
|
|
6
|
+
|
|
7
|
+
// ../core/src/manifest.ts
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { join, dirname } from "node:path";
|
|
10
|
+
import { z as z2 } from "zod";
|
|
11
|
+
|
|
12
|
+
// ../core/src/acpfx-flags.ts
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var SetupCheckResponseSchema = z.object({
|
|
15
|
+
needed: z.boolean(),
|
|
16
|
+
description: z.string().optional()
|
|
17
|
+
});
|
|
18
|
+
var SetupProgressSchema = z.discriminatedUnion("type", [
|
|
19
|
+
z.object({
|
|
20
|
+
type: z.literal("progress"),
|
|
21
|
+
message: z.string(),
|
|
22
|
+
pct: z.number().optional()
|
|
23
|
+
}),
|
|
24
|
+
z.object({ type: z.literal("complete"), message: z.string() }),
|
|
25
|
+
z.object({ type: z.literal("error"), message: z.string() })
|
|
26
|
+
]);
|
|
27
|
+
var UnsupportedFlagResponseSchema = z.object({
|
|
28
|
+
unsupported: z.boolean(),
|
|
29
|
+
flag: z.string()
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// ../core/src/manifest.ts
|
|
33
|
+
var ArgumentTypeSchema = z2.enum(["string", "number", "boolean"]);
|
|
34
|
+
var ManifestArgumentSchema = z2.object({
|
|
35
|
+
type: ArgumentTypeSchema,
|
|
36
|
+
default: z2.unknown().optional(),
|
|
37
|
+
description: z2.string().optional(),
|
|
38
|
+
required: z2.boolean().optional(),
|
|
39
|
+
enum: z2.array(z2.unknown()).optional()
|
|
40
|
+
});
|
|
41
|
+
var ManifestEnvFieldSchema = z2.object({
|
|
42
|
+
required: z2.boolean().optional(),
|
|
43
|
+
description: z2.string().optional()
|
|
44
|
+
});
|
|
45
|
+
var NodeManifestSchema = z2.object({
|
|
46
|
+
name: z2.string(),
|
|
47
|
+
description: z2.string().optional(),
|
|
48
|
+
consumes: z2.array(z2.string()),
|
|
49
|
+
emits: z2.array(z2.string()),
|
|
50
|
+
arguments: z2.record(z2.string(), ManifestArgumentSchema).optional(),
|
|
51
|
+
additional_arguments: z2.boolean().optional(),
|
|
52
|
+
env: z2.record(z2.string(), ManifestEnvFieldSchema).optional()
|
|
53
|
+
});
|
|
54
|
+
function handleAcpfxFlags(manifestPath) {
|
|
55
|
+
const acpfxFlag = process.argv.find((a) => a.startsWith("--acpfx-"));
|
|
56
|
+
const legacyManifest = process.argv.includes("--manifest");
|
|
57
|
+
if (!acpfxFlag && !legacyManifest) return;
|
|
58
|
+
const flag = acpfxFlag ?? "--acpfx-manifest";
|
|
59
|
+
switch (flag) {
|
|
60
|
+
case "--acpfx-manifest":
|
|
61
|
+
printManifest(manifestPath);
|
|
62
|
+
break;
|
|
63
|
+
case "--acpfx-setup-check":
|
|
64
|
+
process.stdout.write(JSON.stringify({ needed: false }) + "\n");
|
|
65
|
+
process.exit(0);
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
process.stdout.write(
|
|
69
|
+
JSON.stringify({ unsupported: true, flag }) + "\n"
|
|
70
|
+
);
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function handleManifestFlag(manifestPath) {
|
|
75
|
+
handleAcpfxFlags(manifestPath);
|
|
76
|
+
}
|
|
77
|
+
function printManifest(manifestPath) {
|
|
78
|
+
if (!manifestPath) {
|
|
79
|
+
const script = process.argv[1];
|
|
80
|
+
const scriptDir = dirname(script);
|
|
81
|
+
const scriptBase = script.replace(/\.[^.]+$/, "");
|
|
82
|
+
const colocated = `${scriptBase}.manifest.json`;
|
|
83
|
+
try {
|
|
84
|
+
readFileSync(colocated);
|
|
85
|
+
manifestPath = colocated;
|
|
86
|
+
} catch {
|
|
87
|
+
manifestPath = join(scriptDir, "manifest.json");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const content = readFileSync(manifestPath, "utf8");
|
|
92
|
+
process.stdout.write(content.trim() + "\n");
|
|
93
|
+
process.exit(0);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
process.stderr.write(`Failed to read manifest: ${err}
|
|
96
|
+
`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ../node-sdk/src/index.ts
|
|
102
|
+
var NODE_NAME = process.env.ACPFX_NODE_NAME ?? "unknown";
|
|
103
|
+
function emit(event) {
|
|
104
|
+
process.stdout.write(JSON.stringify(event) + "\n");
|
|
105
|
+
}
|
|
106
|
+
function log(level, message) {
|
|
107
|
+
emit({ type: "log", level, component: NODE_NAME, message });
|
|
108
|
+
}
|
|
109
|
+
log.info = (message) => log("info", message);
|
|
110
|
+
log.warn = (message) => log("warn", message);
|
|
111
|
+
log.error = (message) => log("error", message);
|
|
112
|
+
log.debug = (message) => log("debug", message);
|
|
113
|
+
function onEvent(handler) {
|
|
114
|
+
const rl2 = createInterface({ input: process.stdin });
|
|
115
|
+
rl2.on("line", (line) => {
|
|
116
|
+
if (!line.trim()) return;
|
|
117
|
+
try {
|
|
118
|
+
const event = JSON.parse(line);
|
|
119
|
+
handler(event);
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return rl2;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/index.ts
|
|
127
|
+
handleManifestFlag();
|
|
128
|
+
emit({ type: "lifecycle.ready", component: "echo" });
|
|
129
|
+
var rl = onEvent((event) => {
|
|
130
|
+
emit(event);
|
|
131
|
+
});
|
|
132
|
+
rl.on("close", () => {
|
|
133
|
+
process.exit(0);
|
|
134
|
+
});
|
|
135
|
+
process.on("SIGTERM", () => {
|
|
136
|
+
rl.close();
|
|
137
|
+
process.exit(0);
|
|
138
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"echo","description":"Echoes all received events back (testing/debugging)","consumes":["audio.chunk","audio.level","speech.partial","speech.delta","speech.final","speech.pause","agent.submit","agent.delta","agent.complete","agent.thinking","agent.tool_start","agent.tool_done","control.interrupt","control.state","control.error","lifecycle.ready","lifecycle.done","log","player.status"],"emits":["audio.chunk","audio.level","speech.partial","speech.delta","speech.final","speech.pause","agent.submit","agent.delta","agent.complete","agent.thinking","agent.tool_start","agent.tool_done","control.interrupt","control.state","control.error","lifecycle.ready","lifecycle.done","log","player.status"]}
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acpfx/echo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"acpfx-echo": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"manifest.yaml"
|
|
12
|
+
],
|
|
9
13
|
"dependencies": {
|
|
10
14
|
"@acpfx/core": "0.4.0",
|
|
11
15
|
"@acpfx/node-sdk": "0.3.0"
|
|
12
16
|
},
|
|
13
17
|
"scripts": {
|
|
14
|
-
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external"
|
|
18
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external && node ../../scripts/copy-manifest.js"
|
|
15
19
|
}
|
|
16
20
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# @acpfx/echo
|
|
2
|
-
|
|
3
|
-
## 0.2.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [0e6838e]
|
|
8
|
-
- @acpfx/core@0.4.0
|
|
9
|
-
- @acpfx/node-sdk@0.3.0
|
|
10
|
-
|
|
11
|
-
## 0.2.1
|
|
12
|
-
|
|
13
|
-
### Patch Changes
|
|
14
|
-
|
|
15
|
-
- Updated dependencies [79c6694]
|
|
16
|
-
- Updated dependencies [a0320a1]
|
|
17
|
-
- @acpfx/core@0.3.0
|
|
18
|
-
- @acpfx/node-sdk@0.2.1
|
|
19
|
-
|
|
20
|
-
## 0.2.0
|
|
21
|
-
|
|
22
|
-
### Minor Changes
|
|
23
|
-
|
|
24
|
-
- d757640: Initial release: type-safe contracts, Rust orchestrator, manifest-driven event filtering
|
|
25
|
-
|
|
26
|
-
- Rust schema crate as canonical event type source of truth with codegen to TypeScript + Zod
|
|
27
|
-
- Node manifests (manifest.yaml) declaring consumes/emits contracts
|
|
28
|
-
- Orchestrator event filtering: nodes only receive declared events
|
|
29
|
-
- Rust orchestrator with ratatui TUI (--ui flag)
|
|
30
|
-
- node-sdk with structured logging helpers
|
|
31
|
-
- CI/CD with GitHub Actions and changesets
|
|
32
|
-
- Platform-specific npm packages for Rust binaries (esbuild-style distribution)
|
|
33
|
-
|
|
34
|
-
### Patch Changes
|
|
35
|
-
|
|
36
|
-
- Updated dependencies [d757640]
|
|
37
|
-
- @acpfx/core@0.2.0
|
|
38
|
-
- @acpfx/node-sdk@0.2.0
|
package/src/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Echo node — trivial test node that reads NDJSON stdin and echoes each event
|
|
3
|
-
* back to stdout unchanged. Emits lifecycle.ready on startup.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { emit, onEvent, handleManifestFlag } from "@acpfx/node-sdk";
|
|
7
|
-
|
|
8
|
-
handleManifestFlag();
|
|
9
|
-
|
|
10
|
-
emit({ type: "lifecycle.ready", component: "echo" });
|
|
11
|
-
|
|
12
|
-
const rl = onEvent((event) => {
|
|
13
|
-
// Echo back unchanged
|
|
14
|
-
emit(event);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
rl.on("close", () => {
|
|
18
|
-
process.exit(0);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
process.on("SIGTERM", () => {
|
|
22
|
-
rl.close();
|
|
23
|
-
process.exit(0);
|
|
24
|
-
});
|