@shardworks/tool-signal 0.1.17

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 ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Sean Boots
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.
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ declare const _default: import("@shardworks/nexus-core").ToolDefinition<{
3
+ name: z.ZodString;
4
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5
+ }>;
6
+ export default _default;
7
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;AAExB,wBAeG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * signal tool.
3
+ *
4
+ * Signals a custom guild event. The event is persisted to the Ledger's events
5
+ * table and will be processed by the Clockworks runner. Validates that the
6
+ * event name is declared in guild.json and is not in a reserved namespace.
7
+ */
8
+ import { tool, validateCustomEvent, signalEvent } from '@shardworks/nexus-core';
9
+ import { z } from 'zod';
10
+ export default tool({
11
+ description: 'Signal a custom guild event for the Clockworks',
12
+ params: {
13
+ name: z.string().describe('Event name (must be declared in guild.json clockworks.events)'),
14
+ payload: z.record(z.string(), z.unknown()).optional().describe('Event payload (JSON object)'),
15
+ },
16
+ handler: (params, { home }) => {
17
+ // Validate the event name is declared and not reserved
18
+ validateCustomEvent(home, params.name);
19
+ // Persist the event
20
+ const eventId = signalEvent(home, params.name, params.payload ?? null, 'anima');
21
+ return { eventId, name: params.name };
22
+ },
23
+ });
24
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,IAAI,CAAC;IAClB,WAAW,EAAE,gDAAgD;IAC7D,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;QAC1F,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;KAC9F;IACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAC5B,uDAAuD;QACvD,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvC,oBAAoB;QACpB,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ # signal
2
+
3
+ Signal a custom guild event. The event is recorded in the Ledger and will be processed by the Clockworks runner when `nsg clock tick` or `nsg clock run` is invoked.
4
+
5
+ ## Usage
6
+
7
+ - The event name **must** be declared in `guild.json` under `clockworks.events`.
8
+ - You **cannot** signal framework events (`anima.*`, `commission.*`, `tool.*`, `migration.*`, `guild.*`, `standing-order.*`) — those are emitted automatically by the framework.
9
+ - The optional payload is a JSON object with event-specific data.
10
+
11
+ ## When to use
12
+
13
+ Signal an event when something meaningful has happened that other parts of the guild should know about. Standing orders in `guild.json` determine what happens in response.
@@ -0,0 +1,6 @@
1
+ {
2
+ "entry": "src/handler.ts",
3
+ "instructions": "instructions.md",
4
+ "version": "0.1.0",
5
+ "description": "Signal custom guild events for the Clockworks"
6
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@shardworks/tool-signal",
3
+ "version": "0.1.17",
4
+ "license": "ISC",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/shardworks/nexus-mk2",
8
+ "directory": "packages/tool-signal"
9
+ },
10
+ "description": "Signal custom guild events for the Clockworks",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/handler.d.ts",
15
+ "import": "./dist/handler.js"
16
+ }
17
+ },
18
+ "dependencies": {
19
+ "zod": "^4.0.0",
20
+ "@shardworks/nexus-core": "0.1.17"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "25.5.0"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "nexus-tool.json",
28
+ "instructions.md"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "typecheck": "tsc --noEmit"
33
+ }
34
+ }