@a5c-ai/agent-comm-mux 5.0.1-staging.04ca6ab00d21
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 +21 -0
- package/README.md +99 -0
- package/dist/adapter-registry.d.ts +51 -0
- package/dist/adapter-registry.d.ts.map +1 -0
- package/dist/adapter-registry.js +208 -0
- package/dist/adapter-registry.js.map +1 -0
- package/dist/adapter-types.d.ts +164 -0
- package/dist/adapter-types.d.ts.map +1 -0
- package/dist/adapter-types.js +27 -0
- package/dist/adapter-types.js.map +1 -0
- package/dist/adapter.d.ts +248 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +18 -0
- package/dist/adapter.js.map +1 -0
- package/dist/atomic-fs.d.ts +33 -0
- package/dist/atomic-fs.d.ts.map +1 -0
- package/dist/atomic-fs.js +190 -0
- package/dist/atomic-fs.js.map +1 -0
- package/dist/auth-manager.d.ts +37 -0
- package/dist/auth-manager.d.ts.map +1 -0
- package/dist/auth-manager.js +94 -0
- package/dist/auth-manager.js.map +1 -0
- package/dist/auth-types.d.ts +83 -0
- package/dist/auth-types.d.ts.map +1 -0
- package/dist/auth-types.js +10 -0
- package/dist/auth-types.js.map +1 -0
- package/dist/automation.d.ts +104 -0
- package/dist/automation.d.ts.map +1 -0
- package/dist/automation.js +2 -0
- package/dist/automation.js.map +1 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +2 -0
- package/dist/browser.js.map +1 -0
- package/dist/builtin-hooks.d.ts +24 -0
- package/dist/builtin-hooks.d.ts.map +1 -0
- package/dist/builtin-hooks.js +80 -0
- package/dist/builtin-hooks.js.map +1 -0
- package/dist/capabilities.d.ts +251 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +7 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/client.d.ts +118 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +316 -0
- package/dist/client.js.map +1 -0
- package/dist/config-manager.d.ts +85 -0
- package/dist/config-manager.d.ts.map +1 -0
- package/dist/config-manager.js +202 -0
- package/dist/config-manager.js.map +1 -0
- package/dist/config-types.d.ts +134 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-types.js +10 -0
- package/dist/config-types.js.map +1 -0
- package/dist/cost-utils.d.ts +31 -0
- package/dist/cost-utils.d.ts.map +1 -0
- package/dist/cost-utils.js +69 -0
- package/dist/cost-utils.js.map +1 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +85 -0
- package/dist/errors.js.map +1 -0
- package/dist/events-control.d.ts +91 -0
- package/dist/events-control.d.ts.map +1 -0
- package/dist/events-control.js +8 -0
- package/dist/events-control.js.map +1 -0
- package/dist/events.d.ts +285 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +8 -0
- package/dist/events.js.map +1 -0
- package/dist/hook-catalog.d.ts +20 -0
- package/dist/hook-catalog.d.ts.map +1 -0
- package/dist/hook-catalog.js +63 -0
- package/dist/hook-catalog.js.map +1 -0
- package/dist/hook-dispatcher.d.ts +24 -0
- package/dist/hook-dispatcher.d.ts.map +1 -0
- package/dist/hook-dispatcher.js +91 -0
- package/dist/hook-dispatcher.js.map +1 -0
- package/dist/hook-payload.d.ts +24 -0
- package/dist/hook-payload.d.ts.map +1 -0
- package/dist/hook-payload.js +62 -0
- package/dist/hook-payload.js.map +1 -0
- package/dist/hooks.d.ts +59 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +118 -0
- package/dist/hooks.js.map +1 -0
- package/dist/host-detection.d.ts +67 -0
- package/dist/host-detection.d.ts.map +1 -0
- package/dist/host-detection.js +147 -0
- package/dist/host-detection.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction-channel-impl.d.ts +56 -0
- package/dist/interaction-channel-impl.d.ts.map +1 -0
- package/dist/interaction-channel-impl.js +159 -0
- package/dist/interaction-channel-impl.js.map +1 -0
- package/dist/interaction.d.ts +93 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +8 -0
- package/dist/interaction.js.map +1 -0
- package/dist/invocation.d.ts +100 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +17 -0
- package/dist/invocation.js.map +1 -0
- package/dist/kanban.d.ts +894 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.js +1155 -0
- package/dist/kanban.js.map +1 -0
- package/dist/merge.d.ts +37 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +102 -0
- package/dist/merge.js.map +1 -0
- package/dist/model-registry.d.ts +61 -0
- package/dist/model-registry.d.ts.map +1 -0
- package/dist/model-registry.js +198 -0
- package/dist/model-registry.js.map +1 -0
- package/dist/plugin-manager-impl.d.ts +48 -0
- package/dist/plugin-manager-impl.d.ts.map +1 -0
- package/dist/plugin-manager-impl.js +343 -0
- package/dist/plugin-manager-impl.js.map +1 -0
- package/dist/plugin-manager.d.ts +81 -0
- package/dist/plugin-manager.d.ts.map +1 -0
- package/dist/plugin-manager.js +7 -0
- package/dist/plugin-manager.js.map +1 -0
- package/dist/plugin-types.d.ts +114 -0
- package/dist/plugin-types.d.ts.map +1 -0
- package/dist/plugin-types.js +7 -0
- package/dist/plugin-types.js.map +1 -0
- package/dist/process-tracker.d.ts +20 -0
- package/dist/process-tracker.d.ts.map +1 -0
- package/dist/process-tracker.js +96 -0
- package/dist/process-tracker.js.map +1 -0
- package/dist/profiles.d.ts +99 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +231 -0
- package/dist/profiles.js.map +1 -0
- package/dist/programmatic-runner.d.ts +4 -0
- package/dist/programmatic-runner.d.ts.map +1 -0
- package/dist/programmatic-runner.js +110 -0
- package/dist/programmatic-runner.js.map +1 -0
- package/dist/provider-config.d.ts +40 -0
- package/dist/provider-config.d.ts.map +1 -0
- package/dist/provider-config.js +67 -0
- package/dist/provider-config.js.map +1 -0
- package/dist/provider-profiles.d.ts +47 -0
- package/dist/provider-profiles.d.ts.map +1 -0
- package/dist/provider-profiles.js +117 -0
- package/dist/provider-profiles.js.map +1 -0
- package/dist/provider-resolver.d.ts +15 -0
- package/dist/provider-resolver.d.ts.map +1 -0
- package/dist/provider-resolver.js +114 -0
- package/dist/provider-resolver.js.map +1 -0
- package/dist/provider-support-matrix.d.ts +12 -0
- package/dist/provider-support-matrix.d.ts.map +1 -0
- package/dist/provider-support-matrix.js +88 -0
- package/dist/provider-support-matrix.js.map +1 -0
- package/dist/remote-runner.d.ts +4 -0
- package/dist/remote-runner.d.ts.map +1 -0
- package/dist/remote-runner.js +114 -0
- package/dist/remote-runner.js.map +1 -0
- package/dist/retry.d.ts +13 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +17 -0
- package/dist/retry.js.map +1 -0
- package/dist/run-handle-cost.d.ts +36 -0
- package/dist/run-handle-cost.d.ts.map +1 -0
- package/dist/run-handle-cost.js +62 -0
- package/dist/run-handle-cost.js.map +1 -0
- package/dist/run-handle-impl.d.ts +144 -0
- package/dist/run-handle-impl.d.ts.map +1 -0
- package/dist/run-handle-impl.js +695 -0
- package/dist/run-handle-impl.js.map +1 -0
- package/dist/run-handle.d.ts +222 -0
- package/dist/run-handle.d.ts.map +1 -0
- package/dist/run-handle.js +9 -0
- package/dist/run-handle.js.map +1 -0
- package/dist/run-options-validation.d.ts +23 -0
- package/dist/run-options-validation.d.ts.map +1 -0
- package/dist/run-options-validation.js +234 -0
- package/dist/run-options-validation.js.map +1 -0
- package/dist/run-options.d.ts +128 -0
- package/dist/run-options.d.ts.map +1 -0
- package/dist/run-options.js +329 -0
- package/dist/run-options.js.map +1 -0
- package/dist/runtime-hook-dispatcher.d.ts +19 -0
- package/dist/runtime-hook-dispatcher.d.ts.map +1 -0
- package/dist/runtime-hook-dispatcher.js +50 -0
- package/dist/runtime-hook-dispatcher.js.map +1 -0
- package/dist/runtime-hooks.d.ts +47 -0
- package/dist/runtime-hooks.d.ts.map +1 -0
- package/dist/runtime-hooks.js +2 -0
- package/dist/runtime-hooks.js.map +1 -0
- package/dist/schema/__tests__/event-schema.test.d.ts +1 -0
- package/dist/schema/__tests__/event-schema.test.d.ts.map +1 -0
- package/dist/schema/__tests__/event-schema.test.js +480 -0
- package/dist/schema/__tests__/event-schema.test.js.map +1 -0
- package/dist/schema/event-schema.d.ts +120 -0
- package/dist/schema/event-schema.d.ts.map +1 -0
- package/dist/schema/event-schema.js +546 -0
- package/dist/schema/event-schema.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +49 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/session-manager-helpers.d.ts +33 -0
- package/dist/session-manager-helpers.d.ts.map +1 -0
- package/dist/session-manager-helpers.js +66 -0
- package/dist/session-manager-helpers.js.map +1 -0
- package/dist/session-manager.d.ts +70 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +343 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/session-types.d.ts +358 -0
- package/dist/session-types.d.ts.map +1 -0
- package/dist/session-types.js +10 -0
- package/dist/session-types.js.map +1 -0
- package/dist/spawn-invocation.d.ts +52 -0
- package/dist/spawn-invocation.d.ts.map +1 -0
- package/dist/spawn-invocation.js +218 -0
- package/dist/spawn-invocation.js.map +1 -0
- package/dist/spawn-runner-utils.d.ts +21 -0
- package/dist/spawn-runner-utils.d.ts.map +1 -0
- package/dist/spawn-runner-utils.js +102 -0
- package/dist/spawn-runner-utils.js.map +1 -0
- package/dist/spawn-runner.d.ts +21 -0
- package/dist/spawn-runner.d.ts.map +1 -0
- package/dist/spawn-runner.js +576 -0
- package/dist/spawn-runner.js.map +1 -0
- package/dist/spawn-runtime-hooks.d.ts +15 -0
- package/dist/spawn-runtime-hooks.d.ts.map +1 -0
- package/dist/spawn-runtime-hooks.js +136 -0
- package/dist/spawn-runtime-hooks.js.map +1 -0
- package/dist/state-machine.d.ts +33 -0
- package/dist/state-machine.d.ts.map +1 -0
- package/dist/state-machine.js +61 -0
- package/dist/state-machine.js.map +1 -0
- package/dist/storage.d.ts +47 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +90 -0
- package/dist/storage.js.map +1 -0
- package/dist/stream-assembler.d.ts +51 -0
- package/dist/stream-assembler.d.ts.map +1 -0
- package/dist/stream-assembler.js +86 -0
- package/dist/stream-assembler.js.map +1 -0
- package/dist/tools/classify.d.ts +9 -0
- package/dist/tools/classify.d.ts.map +1 -0
- package/dist/tools/classify.js +77 -0
- package/dist/tools/classify.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +288 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/workspaces.d.ts +142 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +515 -0
- package/dist/workspaces.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic payload parser/formatter used by `amux hooks handle <agent> <hookType>`.
|
|
3
|
+
*
|
|
4
|
+
* Each harness emits a hook payload as JSON on stdin. The default
|
|
5
|
+
* implementation accepts any JSON object and normalizes a few commonly
|
|
6
|
+
* used fields (tool_name, tool_input, tool_output, prompt, message,
|
|
7
|
+
* session_id) into `payload.data`, preserving the full original payload
|
|
8
|
+
* under `payload.raw` for adapter-specific round-tripping.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentName } from './types.js';
|
|
11
|
+
import type { UnifiedHookPayload, UnifiedHookResult } from './hooks.js';
|
|
12
|
+
export declare function parseHookPayload(agent: AgentName | string, hookType: string, raw: unknown): UnifiedHookPayload;
|
|
13
|
+
/**
|
|
14
|
+
* Format a unified hook result back into the shape most harnesses expect:
|
|
15
|
+
* a JSON object written to stdout, plus an exit code.
|
|
16
|
+
*
|
|
17
|
+
* Convention:
|
|
18
|
+
* { decision, message?, modifiedInput? }
|
|
19
|
+
* harnesses that treat exit 2 as "block" will honor the deny path.
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatHookResult(_agent: AgentName | string, _hookType: string, result: UnifiedHookResult): {
|
|
22
|
+
stdout: string;
|
|
23
|
+
exitCode: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-payload.d.ts","sourceRoot":"","sources":["../src/hook-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAaxE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,GAAG,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,OAAO,GACX,kBAAkB,CAkBpB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,GAAG,MAAM,EAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,iBAAiB,GACxB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAWtC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic payload parser/formatter used by `amux hooks handle <agent> <hookType>`.
|
|
3
|
+
*
|
|
4
|
+
* Each harness emits a hook payload as JSON on stdin. The default
|
|
5
|
+
* implementation accepts any JSON object and normalizes a few commonly
|
|
6
|
+
* used fields (tool_name, tool_input, tool_output, prompt, message,
|
|
7
|
+
* session_id) into `payload.data`, preserving the full original payload
|
|
8
|
+
* under `payload.raw` for adapter-specific round-tripping.
|
|
9
|
+
*/
|
|
10
|
+
const NORMALIZED_FIELDS = [
|
|
11
|
+
'tool_name',
|
|
12
|
+
'tool_input',
|
|
13
|
+
'tool_output',
|
|
14
|
+
'prompt',
|
|
15
|
+
'message',
|
|
16
|
+
'response',
|
|
17
|
+
'cwd',
|
|
18
|
+
'transcript_path',
|
|
19
|
+
];
|
|
20
|
+
export function parseHookPayload(agent, hookType, raw) {
|
|
21
|
+
const obj = (raw && typeof raw === 'object') ? raw : {};
|
|
22
|
+
const data = {};
|
|
23
|
+
for (const k of NORMALIZED_FIELDS) {
|
|
24
|
+
if (k in obj)
|
|
25
|
+
data[k] = obj[k];
|
|
26
|
+
}
|
|
27
|
+
const sessionId = typeof obj['session_id'] === 'string' ? obj['session_id']
|
|
28
|
+
: typeof obj['sessionId'] === 'string' ? obj['sessionId']
|
|
29
|
+
: undefined;
|
|
30
|
+
return {
|
|
31
|
+
agent: agent,
|
|
32
|
+
hookType,
|
|
33
|
+
sessionId,
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
data,
|
|
36
|
+
raw: obj,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Format a unified hook result back into the shape most harnesses expect:
|
|
41
|
+
* a JSON object written to stdout, plus an exit code.
|
|
42
|
+
*
|
|
43
|
+
* Convention:
|
|
44
|
+
* { decision, message?, modifiedInput? }
|
|
45
|
+
* harnesses that treat exit 2 as "block" will honor the deny path.
|
|
46
|
+
*/
|
|
47
|
+
export function formatHookResult(_agent, _hookType, result) {
|
|
48
|
+
const body = {};
|
|
49
|
+
if (result.decision)
|
|
50
|
+
body['decision'] = result.decision;
|
|
51
|
+
if (result.message)
|
|
52
|
+
body['message'] = result.message;
|
|
53
|
+
if (result.modifiedInput)
|
|
54
|
+
body['modifiedInput'] = result.modifiedInput;
|
|
55
|
+
const extra = result.stdout ? result.stdout : '';
|
|
56
|
+
const exit = result.decision === 'deny' ? 2 : (result.exitCode ?? 0);
|
|
57
|
+
return {
|
|
58
|
+
stdout: (Object.keys(body).length > 0 ? JSON.stringify(body) + '\n' : '') + extra,
|
|
59
|
+
exitCode: exit,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=hook-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-payload.js","sourceRoot":"","sources":["../src/hook-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,iBAAiB,GAAG;IACxB,WAAW;IACX,YAAY;IACZ,aAAa;IACb,QAAQ;IACR,SAAS;IACT,UAAU;IACV,KAAK;IACL,iBAAiB;CAClB,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAC9B,KAAyB,EACzB,QAAgB,EAChB,GAAY;IAEZ,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAE,GAA+B,CAAC,CAAC,CAAC,EAAE,CAAC;IACrF,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,iBAAiB,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,SAAS,GACb,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,GAAG,CAAC,YAAY,CAAY;QACrE,CAAC,CAAC,OAAO,GAAG,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,GAAG,CAAC,WAAW,CAAY;YACrE,CAAC,CAAC,SAAS,CAAC;IACd,OAAO;QACL,KAAK,EAAE,KAAkB;QACzB,QAAQ;QACR,SAAS;QACT,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,IAAI;QACJ,GAAG,EAAE,GAAG;KACT,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA0B,EAC1B,SAAiB,EACjB,MAAyB;IAEzB,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,MAAM,CAAC,QAAQ;QAAE,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;IACxD,IAAI,MAAM,CAAC,OAAO;QAAE,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;IACrD,IAAI,MAAM,CAAC,aAAa;QAAE,IAAI,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC;IACvE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;IACrE,OAAO;QACL,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK;QACjF,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified hooks system — types + HookConfigManager.
|
|
3
|
+
*
|
|
4
|
+
* Provides a harness-agnostic format for hook payloads and results so amux
|
|
5
|
+
* can dispatch to user-registered hooks and programmatic built-ins regardless
|
|
6
|
+
* of which harness emitted the event.
|
|
7
|
+
*
|
|
8
|
+
* Configs are stored at:
|
|
9
|
+
* - `~/.amux/hooks.json` (global)
|
|
10
|
+
* - `<cwd>/.amux/hooks.json` (project — overrides global by id)
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentName } from './types.js';
|
|
13
|
+
/** Unified hook payload shape. */
|
|
14
|
+
export interface UnifiedHookPayload {
|
|
15
|
+
agent: AgentName;
|
|
16
|
+
hookType: string;
|
|
17
|
+
sessionId?: string;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
/** Normalized fields: tool_name, tool_input, tool_output, prompt, message, etc. */
|
|
20
|
+
data: Record<string, unknown>;
|
|
21
|
+
/** The original harness-specific payload (for round-trip). */
|
|
22
|
+
raw: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/** Unified hook result. */
|
|
25
|
+
export interface UnifiedHookResult {
|
|
26
|
+
decision?: 'allow' | 'deny' | 'modify';
|
|
27
|
+
message?: string;
|
|
28
|
+
modifiedInput?: Record<string, unknown>;
|
|
29
|
+
stdout?: string;
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
}
|
|
32
|
+
/** Registration entry in hooks.json. */
|
|
33
|
+
export interface HookRegistration {
|
|
34
|
+
id: string;
|
|
35
|
+
agent: AgentName | '*';
|
|
36
|
+
hookType: string | '*';
|
|
37
|
+
handler: 'builtin' | 'command' | 'script';
|
|
38
|
+
target: string;
|
|
39
|
+
priority?: number;
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/** Scope selector for add/set operations. */
|
|
44
|
+
export type HookScope = 'global' | 'project';
|
|
45
|
+
/**
|
|
46
|
+
* Manages user-registered hook registrations across global + project scope.
|
|
47
|
+
*/
|
|
48
|
+
export declare class HookConfigManager {
|
|
49
|
+
readonly globalPath: string;
|
|
50
|
+
readonly projectPath: string;
|
|
51
|
+
constructor(globalPath?: string, projectPath?: string);
|
|
52
|
+
/** Returns the merged hook list (project overrides global by id). */
|
|
53
|
+
list(): Promise<HookRegistration[]>;
|
|
54
|
+
add(reg: HookRegistration, scope?: HookScope): Promise<void>;
|
|
55
|
+
remove(id: string, scope?: HookScope): Promise<boolean>;
|
|
56
|
+
set(id: string, patch: Partial<HookRegistration>): Promise<HookRegistration | null>;
|
|
57
|
+
/** Returns matching hooks sorted by priority asc (default 100). Only enabled. */
|
|
58
|
+
getForAgent(agent: AgentName, hookType: string): Promise<HookRegistration[]>;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B;AAED,2BAA2B;AAC3B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;IACvB,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAiC7C;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,UAAU,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IAKrD,qEAAqE;IAC/D,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAWnC,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,GAAE,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBvD,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAezF,iFAAiF;IAC3E,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAWnF"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified hooks system — types + HookConfigManager.
|
|
3
|
+
*
|
|
4
|
+
* Provides a harness-agnostic format for hook payloads and results so amux
|
|
5
|
+
* can dispatch to user-registered hooks and programmatic built-ins regardless
|
|
6
|
+
* of which harness emitted the event.
|
|
7
|
+
*
|
|
8
|
+
* Configs are stored at:
|
|
9
|
+
* - `~/.amux/hooks.json` (global)
|
|
10
|
+
* - `<cwd>/.amux/hooks.json` (project — overrides global by id)
|
|
11
|
+
*/
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import * as os from 'node:os';
|
|
14
|
+
import * as fs from 'node:fs/promises';
|
|
15
|
+
import { writeJsonAtomic } from './atomic-fs.js';
|
|
16
|
+
function defaultGlobalPath() {
|
|
17
|
+
return path.join(os.homedir(), '.amux', 'hooks.json');
|
|
18
|
+
}
|
|
19
|
+
function defaultProjectPath(cwd = process.cwd()) {
|
|
20
|
+
return path.join(cwd, '.amux', 'hooks.json');
|
|
21
|
+
}
|
|
22
|
+
async function readFile(p) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = await fs.readFile(p, 'utf8');
|
|
25
|
+
const parsed = JSON.parse(raw);
|
|
26
|
+
if (!parsed || !Array.isArray(parsed.hooks)) {
|
|
27
|
+
return { version: 1, hooks: [] };
|
|
28
|
+
}
|
|
29
|
+
return { version: 1, hooks: parsed.hooks };
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return { version: 1, hooks: [] };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function writeFile(p, data) {
|
|
36
|
+
await writeJsonAtomic(p, data);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Manages user-registered hook registrations across global + project scope.
|
|
40
|
+
*/
|
|
41
|
+
export class HookConfigManager {
|
|
42
|
+
globalPath;
|
|
43
|
+
projectPath;
|
|
44
|
+
constructor(globalPath, projectPath) {
|
|
45
|
+
this.globalPath = globalPath ?? defaultGlobalPath();
|
|
46
|
+
this.projectPath = projectPath ?? defaultProjectPath();
|
|
47
|
+
}
|
|
48
|
+
/** Returns the merged hook list (project overrides global by id). */
|
|
49
|
+
async list() {
|
|
50
|
+
const [g, p] = await Promise.all([
|
|
51
|
+
readFile(this.globalPath),
|
|
52
|
+
readFile(this.projectPath),
|
|
53
|
+
]);
|
|
54
|
+
const byId = new Map();
|
|
55
|
+
for (const h of g.hooks)
|
|
56
|
+
byId.set(h.id, h);
|
|
57
|
+
for (const h of p.hooks)
|
|
58
|
+
byId.set(h.id, h);
|
|
59
|
+
return Array.from(byId.values());
|
|
60
|
+
}
|
|
61
|
+
async add(reg, scope = 'project') {
|
|
62
|
+
const target = scope === 'global' ? this.globalPath : this.projectPath;
|
|
63
|
+
const file = await readFile(target);
|
|
64
|
+
const existing = file.hooks.findIndex((h) => h.id === reg.id);
|
|
65
|
+
if (existing >= 0) {
|
|
66
|
+
file.hooks[existing] = reg;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
file.hooks.push(reg);
|
|
70
|
+
}
|
|
71
|
+
await writeFile(target, file);
|
|
72
|
+
}
|
|
73
|
+
async remove(id, scope) {
|
|
74
|
+
const scopes = scope ? [scope] : ['project', 'global'];
|
|
75
|
+
let removed = false;
|
|
76
|
+
for (const s of scopes) {
|
|
77
|
+
const target = s === 'global' ? this.globalPath : this.projectPath;
|
|
78
|
+
const file = await readFile(target);
|
|
79
|
+
const before = file.hooks.length;
|
|
80
|
+
file.hooks = file.hooks.filter((h) => h.id !== id);
|
|
81
|
+
if (file.hooks.length !== before) {
|
|
82
|
+
await writeFile(target, file);
|
|
83
|
+
removed = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return removed;
|
|
87
|
+
}
|
|
88
|
+
async set(id, patch) {
|
|
89
|
+
// Prefer project scope; fall back to global.
|
|
90
|
+
for (const target of [this.projectPath, this.globalPath]) {
|
|
91
|
+
const file = await readFile(target);
|
|
92
|
+
const idx = file.hooks.findIndex((h) => h.id === id);
|
|
93
|
+
if (idx >= 0) {
|
|
94
|
+
const merged = { ...file.hooks[idx], ...patch, id };
|
|
95
|
+
file.hooks[idx] = merged;
|
|
96
|
+
await writeFile(target, file);
|
|
97
|
+
return merged;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/** Returns matching hooks sorted by priority asc (default 100). Only enabled. */
|
|
103
|
+
async getForAgent(agent, hookType) {
|
|
104
|
+
const all = await this.list();
|
|
105
|
+
const matching = all.filter((h) => {
|
|
106
|
+
if (h.enabled === false)
|
|
107
|
+
return false;
|
|
108
|
+
if (h.agent !== '*' && h.agent !== agent)
|
|
109
|
+
return false;
|
|
110
|
+
if (h.hookType !== '*' && h.hookType !== hookType)
|
|
111
|
+
return false;
|
|
112
|
+
return true;
|
|
113
|
+
});
|
|
114
|
+
matching.sort((a, b) => (a.priority ?? 100) - (b.priority ?? 100));
|
|
115
|
+
return matching;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA4CjD,SAAS,iBAAiB;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,CAAS;IAC/B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAuB,CAAC;QACrD,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC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AAC,CAAC,OAAO,KAAK,KAAK;gBAAE,OAAO,KAAK,CAAC;YACtC,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK;gBAAE,OAAO,KAAK,CAAC;YACvD,IAAI,CAAC,CAAC,QAAQ,KAAK,GAAG,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-harness detection.
|
|
3
|
+
*
|
|
4
|
+
* Detects whether the current process is itself running *under* one of the
|
|
5
|
+
* supported harnesses (as a child of that harness process). Useful for tools
|
|
6
|
+
* like `amux` to distinguish "invoked from a shell" vs "invoked from Claude
|
|
7
|
+
* Code / Codex / ... as a subprocess".
|
|
8
|
+
*
|
|
9
|
+
* Detection is synchronous and purely environmental — it does not spawn
|
|
10
|
+
* subprocesses or read files. Signals come from:
|
|
11
|
+
* - env vars set by the enclosing harness
|
|
12
|
+
* - argv patterns (best-effort)
|
|
13
|
+
* - ppid heuristics when available
|
|
14
|
+
*
|
|
15
|
+
* Adapters contribute their known env signals via `hostEnvSignals`. A default
|
|
16
|
+
* catalog is embedded here for when the adapters package is not loaded.
|
|
17
|
+
*/
|
|
18
|
+
import type { AgentName } from './types.js';
|
|
19
|
+
/** Information about a detected host harness. */
|
|
20
|
+
export interface HostHarnessInfo {
|
|
21
|
+
/** The harness the current process is running under. */
|
|
22
|
+
agent: AgentName;
|
|
23
|
+
/** Confidence in the detection. */
|
|
24
|
+
confidence: 'high' | 'medium' | 'low';
|
|
25
|
+
/** Which signal was strongest. */
|
|
26
|
+
source: 'env' | 'ppid' | 'argv';
|
|
27
|
+
/** The concrete matched signals, for diagnostics. */
|
|
28
|
+
matchedSignals: string[];
|
|
29
|
+
/** Adapter-contributed metadata extracted from the host environment. */
|
|
30
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
31
|
+
}
|
|
32
|
+
/** Map from agent name -> env var names that indicate that harness is the parent. */
|
|
33
|
+
export type HostSignalMap = Readonly<Record<string, readonly string[]>>;
|
|
34
|
+
/** Function signature for per-agent metadata extraction from env. */
|
|
35
|
+
export type HostMetadataReader = (env: NodeJS.ProcessEnv) => Record<string, string | number | boolean | null>;
|
|
36
|
+
/** Map from agent name -> metadata reader. Used by adapter contributions. */
|
|
37
|
+
export type HostMetadataMap = Readonly<Record<string, HostMetadataReader>>;
|
|
38
|
+
export declare const DEFAULT_HOST_METADATA: HostMetadataMap;
|
|
39
|
+
/**
|
|
40
|
+
* Default env-signal catalog for the ten built-in harnesses.
|
|
41
|
+
*
|
|
42
|
+
* These are typical env vars known to be set by each harness when it
|
|
43
|
+
* spawns a child shell/subprocess. Extend via `detectHostHarness({ signals })`
|
|
44
|
+
* for plugin adapters.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DEFAULT_HOST_SIGNALS: HostSignalMap;
|
|
47
|
+
/** Options for `detectHostHarness`. */
|
|
48
|
+
export interface DetectHostHarnessOptions {
|
|
49
|
+
/** Override or extend the signal catalog. Merged over defaults. */
|
|
50
|
+
signals?: HostSignalMap;
|
|
51
|
+
/** Override or extend the metadata reader catalog. Merged over defaults. */
|
|
52
|
+
metadata?: HostMetadataMap;
|
|
53
|
+
/** Override process.env (for tests). */
|
|
54
|
+
env?: NodeJS.ProcessEnv;
|
|
55
|
+
/** Override process.argv (for tests). */
|
|
56
|
+
argv?: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Detect whether the current process is running inside a supported harness.
|
|
60
|
+
*
|
|
61
|
+
* Returns `null` if no signals match. Confidence:
|
|
62
|
+
* - `high` if 2+ env signals for the same agent matched, or a single
|
|
63
|
+
* explicit `CLAUDECODE=1`-style flag in addition to other hints.
|
|
64
|
+
* - `medium` if exactly one env signal matched.
|
|
65
|
+
* - `low` if only argv heuristics matched.
|
|
66
|
+
*/
|
|
67
|
+
export declare function detectHostHarness(opts?: DetectHostHarnessOptions): HostHarnessInfo | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-detection.d.ts","sourceRoot":"","sources":["../src/host-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,KAAK,EAAE,SAAS,CAAC;IACjB,mCAAmC;IACnC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,kCAAkC;IAClC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAChC,qDAAqD;IACrD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;CAC7D;AAED,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,CAC/B,GAAG,EAAE,MAAM,CAAC,UAAU,KACnB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AAEtD,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAyB3E,eAAO,MAAM,qBAAqB,EAAE,eAkBnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAGlC,CAAC;AAEF,uCAAuC;AACvC,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,yCAAyC;IACzC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAsBD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,wBAA6B,GAClC,eAAe,GAAG,IAAI,CA6DxB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-harness detection.
|
|
3
|
+
*
|
|
4
|
+
* Detects whether the current process is itself running *under* one of the
|
|
5
|
+
* supported harnesses (as a child of that harness process). Useful for tools
|
|
6
|
+
* like `amux` to distinguish "invoked from a shell" vs "invoked from Claude
|
|
7
|
+
* Code / Codex / ... as a subprocess".
|
|
8
|
+
*
|
|
9
|
+
* Detection is synchronous and purely environmental — it does not spawn
|
|
10
|
+
* subprocesses or read files. Signals come from:
|
|
11
|
+
* - env vars set by the enclosing harness
|
|
12
|
+
* - argv patterns (best-effort)
|
|
13
|
+
* - ppid heuristics when available
|
|
14
|
+
*
|
|
15
|
+
* Adapters contribute their known env signals via `hostEnvSignals`. A default
|
|
16
|
+
* catalog is embedded here for when the adapters package is not loaded.
|
|
17
|
+
*/
|
|
18
|
+
import { getHostDetectionRules, getHostMetadataFields, getHostSignalMap } from '@a5c-ai/agent-catalog';
|
|
19
|
+
const HOST_METADATA_FIELDS = getHostMetadataFields();
|
|
20
|
+
const HOST_DETECTION_RULES = getHostDetectionRules();
|
|
21
|
+
function createMetadataReader(agent) {
|
|
22
|
+
const fields = HOST_METADATA_FIELDS[agent] ?? [];
|
|
23
|
+
return (env) => {
|
|
24
|
+
const metadata = {};
|
|
25
|
+
for (const field of fields) {
|
|
26
|
+
const matched = field.envVars.find((envVar) => {
|
|
27
|
+
const value = env[envVar];
|
|
28
|
+
return value !== undefined && value !== '';
|
|
29
|
+
});
|
|
30
|
+
metadata[field.key] = matched ? env[matched] ?? null : null;
|
|
31
|
+
}
|
|
32
|
+
return metadata;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Default per-agent metadata extraction from common env vars. */
|
|
36
|
+
const BASE_HOST_METADATA = Object.fromEntries(Object.keys(HOST_METADATA_FIELDS).map((agent) => [agent, createMetadataReader(agent)]));
|
|
37
|
+
export const DEFAULT_HOST_METADATA = Object.fromEntries(Object.entries(BASE_HOST_METADATA).map(([agent, reader]) => {
|
|
38
|
+
if (agent !== 'codex') {
|
|
39
|
+
return [agent, reader];
|
|
40
|
+
}
|
|
41
|
+
return [agent, (env) => {
|
|
42
|
+
const metadata = { ...(reader(env) ?? {}) };
|
|
43
|
+
if ((metadata['session_id'] == null || metadata['session_id'] === '')
|
|
44
|
+
&& typeof env['CODEX_THREAD_ID'] === 'string'
|
|
45
|
+
&& env['CODEX_THREAD_ID'].trim().length > 0) {
|
|
46
|
+
metadata['session_id'] = env['CODEX_THREAD_ID'];
|
|
47
|
+
}
|
|
48
|
+
return metadata;
|
|
49
|
+
}];
|
|
50
|
+
}));
|
|
51
|
+
/**
|
|
52
|
+
* Default env-signal catalog for the ten built-in harnesses.
|
|
53
|
+
*
|
|
54
|
+
* These are typical env vars known to be set by each harness when it
|
|
55
|
+
* spawns a child shell/subprocess. Extend via `detectHostHarness({ signals })`
|
|
56
|
+
* for plugin adapters.
|
|
57
|
+
*/
|
|
58
|
+
export const DEFAULT_HOST_SIGNALS = {
|
|
59
|
+
...getHostSignalMap(),
|
|
60
|
+
codex: Array.from(new Set([...(getHostSignalMap()['codex'] ?? []), 'CODEX_THREAD_ID'])),
|
|
61
|
+
};
|
|
62
|
+
function extractMetadata(agent, env, readers) {
|
|
63
|
+
const reader = readers[agent];
|
|
64
|
+
if (!reader)
|
|
65
|
+
return undefined;
|
|
66
|
+
const meta = reader(env);
|
|
67
|
+
// Drop null/undefined entries entirely to keep output clean.
|
|
68
|
+
const out = {};
|
|
69
|
+
let hasAny = false;
|
|
70
|
+
for (const [k, v] of Object.entries(meta)) {
|
|
71
|
+
if (v !== null && v !== undefined && v !== '') {
|
|
72
|
+
out[k] = v;
|
|
73
|
+
hasAny = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return hasAny ? out : undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Detect whether the current process is running inside a supported harness.
|
|
80
|
+
*
|
|
81
|
+
* Returns `null` if no signals match. Confidence:
|
|
82
|
+
* - `high` if 2+ env signals for the same agent matched, or a single
|
|
83
|
+
* explicit `CLAUDECODE=1`-style flag in addition to other hints.
|
|
84
|
+
* - `medium` if exactly one env signal matched.
|
|
85
|
+
* - `low` if only argv heuristics matched.
|
|
86
|
+
*/
|
|
87
|
+
export function detectHostHarness(opts = {}) {
|
|
88
|
+
const env = opts.env ?? process.env;
|
|
89
|
+
const argv = opts.argv ?? process.argv;
|
|
90
|
+
const signals = {
|
|
91
|
+
...DEFAULT_HOST_SIGNALS,
|
|
92
|
+
...(opts.signals ?? {}),
|
|
93
|
+
};
|
|
94
|
+
const metadataReaders = {
|
|
95
|
+
...DEFAULT_HOST_METADATA,
|
|
96
|
+
...(opts.metadata ?? {}),
|
|
97
|
+
};
|
|
98
|
+
// Score each agent by number of matched env signals.
|
|
99
|
+
const matches = new Map();
|
|
100
|
+
for (const [agent, vars] of Object.entries(signals)) {
|
|
101
|
+
const hit = [];
|
|
102
|
+
for (const v of vars) {
|
|
103
|
+
const val = env[v];
|
|
104
|
+
if (val !== undefined && val !== '')
|
|
105
|
+
hit.push(v);
|
|
106
|
+
}
|
|
107
|
+
if (hit.length > 0)
|
|
108
|
+
matches.set(agent, hit);
|
|
109
|
+
}
|
|
110
|
+
if (matches.size > 0) {
|
|
111
|
+
// Pick the agent with the most matched signals; stable on insertion order.
|
|
112
|
+
let bestAgent = null;
|
|
113
|
+
let bestHits = [];
|
|
114
|
+
for (const [agent, hits] of matches) {
|
|
115
|
+
if (hits.length > bestHits.length) {
|
|
116
|
+
bestAgent = agent;
|
|
117
|
+
bestHits = hits;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (bestAgent) {
|
|
121
|
+
return {
|
|
122
|
+
agent: bestAgent,
|
|
123
|
+
confidence: bestHits.length >= 2 ? 'high' : 'medium',
|
|
124
|
+
source: 'env',
|
|
125
|
+
matchedSignals: bestHits,
|
|
126
|
+
metadata: extractMetadata(bestAgent, env, metadataReaders),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// argv heuristic fallback (low confidence).
|
|
131
|
+
const joined = argv.join(' ').toLowerCase();
|
|
132
|
+
for (const rule of HOST_DETECTION_RULES) {
|
|
133
|
+
for (const needle of rule.argvMatches) {
|
|
134
|
+
if (joined.includes(` ${needle}`) || joined.includes(`/${needle}`) || joined.includes(`\\${needle}`)) {
|
|
135
|
+
return {
|
|
136
|
+
agent: rule.agent,
|
|
137
|
+
confidence: 'low',
|
|
138
|
+
source: 'argv',
|
|
139
|
+
matchedSignals: [needle],
|
|
140
|
+
metadata: extractMetadata(rule.agent, env, metadataReaders),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=host-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-detection.js","sourceRoot":"","sources":["../src/host-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAA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MAAM;oBACd,cAAc,EAAE,CAAC,MAAM,CAAC;oBACxB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC;iBAC5D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @a5c-ai/agent-comm-mux
|
|
3
|
+
*
|
|
4
|
+
* Core runtime, types, and utilities for agent-mux.
|
|
5
|
+
* Runtime deps: @a5c-ai/agent-catalog and @a5c-ai/agent-mux-observability.
|
|
6
|
+
*/
|
|
7
|
+
export type { BuiltInAgentName, AgentName, ErrorCode, ValidationFieldError, BaseEvent, GlobalConfig, AuthHintsFile, AuthHintEntry, RunIndexEntry, CostRecord, ProfileData, PluginFormat, RetryPolicy, McpServerConfig, Attachment, } from './types.js';
|
|
8
|
+
export { AgentMuxError, CapabilityError, ValidationError, AuthError, } from './errors.js';
|
|
9
|
+
export type { ResolvedRetryPolicy } from './retry.js';
|
|
10
|
+
export { DEFAULT_RETRY_POLICY } from './retry.js';
|
|
11
|
+
export type { StoragePaths, StoragePathOptions } from './storage.js';
|
|
12
|
+
export { resolveStoragePaths } from './storage.js';
|
|
13
|
+
export type { WorkspaceMaterializationMode, WorkspaceSessionStatus, WorkspaceStatus, WorkspaceRepoInput, WorkspaceCreateInput, WorkspaceSessionBinding, WorkspaceSessionContext, WorkspaceSessionRepoContext, WorkspaceRepoRecord, WorkspaceRecord, WorkspaceRepoSummary, WorkspaceActionAvailability, WorkspaceSummary, WorkspaceListResult, WorkspaceServiceDeps, } from './workspaces.js';
|
|
14
|
+
export { WorkspaceService, resolveWorkspaceDefaultCwd } from './workspaces.js';
|
|
15
|
+
export type { AgentEvent, AgentEventType, AgentEventHandler, EventOfType, SessionStartEvent, SessionResumeEvent, SessionForkEvent, SessionCheckpointEvent, SessionEndEvent, TurnStartEvent, TurnEndEvent, StepStartEvent, StepEndEvent, MessageStartEvent, TextDeltaEvent, MessageStopEvent, ThinkingStartEvent, ThinkingDeltaEvent, ThinkingStopEvent, ToolCallStartEvent, ToolInputDeltaEvent, ToolCallReadyEvent, ToolResultEvent, ToolErrorEvent, FileReadEvent, FileWriteEvent, FileCreateEvent, FileDeleteEvent, FilePatchEvent, ShellStartEvent, ShellStdoutDeltaEvent, ShellStderrDeltaEvent, ShellExitEvent, McpToolCallStartEvent, McpToolResultEvent, McpToolErrorEvent, SubagentSpawnEvent, SubagentResultEvent, SubagentErrorEvent, PluginLoadedEvent, PluginInvokedEvent, PluginErrorEvent, SkillLoadedEvent, SkillInvokedEvent, AgentdocReadEvent, ImageOutputEvent, ImageInputAckEvent, CostEvent, TokenUsageEvent, InputRequiredEvent, ApprovalRequestEvent, ApprovalGrantedEvent, ApprovalDeniedEvent, RateLimitedEvent, ContextLimitWarningEvent, ContextCompactedEvent, RetryEvent, InterruptedEvent, AbortedEvent, PausedEvent, ResumedEvent, TimeoutEvent, TurnLimitEvent, StreamFallbackEvent, AuthErrorEvent, RateLimitErrorEvent, ContextExceededEvent, CrashEvent, ErrorEvent, DebugEvent, LogEvent, } from './events.js';
|
|
16
|
+
export type { EventCostSummary } from './cost-utils.js';
|
|
17
|
+
export { sumCost, sumCostAsync, filterEvents, filterEventsAsync, } from './cost-utils.js';
|
|
18
|
+
export type { RunState } from './state-machine.js';
|
|
19
|
+
export { TERMINAL_STATES, VALID_TRANSITIONS, isTerminal, assertTransition, } from './state-machine.js';
|
|
20
|
+
export type { InteractionChannel, PendingInteraction, InteractionDetail, ApprovalDetail, InputDetail, InteractionResponse, ApproveResponse, DenyResponse, TextInputResponse, } from './interaction.js';
|
|
21
|
+
export { InteractionChannelImpl } from './interaction-channel-impl.js';
|
|
22
|
+
export type { DeferredPromptTarget, DeferredPromptOptions, RunHandle, RunResult, TokenUsageSummary, RunError, } from './run-handle.js';
|
|
23
|
+
export { RunHandleImpl } from './run-handle-impl.js';
|
|
24
|
+
export type { RunHandleImplOptions } from './run-handle-impl.js';
|
|
25
|
+
export type { ProcessTracker } from './process-tracker.js';
|
|
26
|
+
export { processTracker } from './process-tracker.js';
|
|
27
|
+
export type { InvocationMode, InvocationModeType, LocalInvocation, DockerInvocation, SshInvocation, K8sInvocation, HarnessImageEntry, } from './invocation.js';
|
|
28
|
+
export { HARNESS_IMAGE_CATALOG, lookupHarnessImage } from './invocation.js';
|
|
29
|
+
export { buildInvocationCommand } from './spawn-runner.js';
|
|
30
|
+
export type { InvocationCommand } from './spawn-runner.js';
|
|
31
|
+
export type { RunOptions } from './run-options.js';
|
|
32
|
+
export { validateRunOptions, PROHIBITED_PROFILE_FIELDS, validateProfileData, } from './run-options.js';
|
|
33
|
+
export type { RuntimeHookKind, RuntimeHookMode, RuntimeHookCapabilities, HookContext, HookDecision, PreToolUseHook, UserPromptSubmitHook, NotificationHook, RuntimeHooks, RuntimeHookSetup, } from './runtime-hooks.js';
|
|
34
|
+
export { RuntimeHookDispatcher, RuntimeHookDispatcher as PerRunRuntimeHookDispatcher } from './runtime-hook-dispatcher.js';
|
|
35
|
+
export type { ToolClassification } from './tools/index.js';
|
|
36
|
+
export { classifyTool } from './tools/index.js';
|
|
37
|
+
export { deepMerge, stripUndefined, resolveRunOptions } from './merge.js';
|
|
38
|
+
export type { ProfileListOptions, ProfileEntry, ResolvedProfile, ProfileSetOptions, ProfileDeleteOptions, ProfileManager, } from './profiles.js';
|
|
39
|
+
export { ProfileManagerImpl } from './profiles.js';
|
|
40
|
+
export type { ThinkingEffortLevel, ModelProtocol, ModelDeployment, SessionControlPlane, PluginRegistry, InstallMethod, AgentCapabilities, ModelCapabilities, ModelValidationResult, } from './capabilities.js';
|
|
41
|
+
export type { BlockTerminator } from './stream-assembler.js';
|
|
42
|
+
export { StreamAssembler } from './stream-assembler.js';
|
|
43
|
+
export type { Session, SessionMessage, SessionToolCall, SessionSummary, FullSession, WorkspaceRuntimeDeviceProfile, WorkspaceRuntimeLogLine, WorkspaceTerminalCommand, WorkspacePreviewSurface, WorkspaceTerminalSurface, WorkspaceDevServerSurface, WorkspaceRebaseStatus, WorkspaceRebaseLastAction, WorkspaceRebaseSurface, WorkspaceRuntimeSurface, SessionListOptions, SessionQuery, CostAggregationOptions, CostSummary, CostBreakdown, SessionDiff, DiffOperation, } from './session-types.js';
|
|
44
|
+
export type { KanbanPriority, KanbanIssueStatus, KanbanWorkflowState, KanbanSwimlaneId, KanbanDispatchReadiness, KanbanDependencyType, KanbanDecompositionStatus, KanbanDecompositionKind, KanbanRepositoryProvider, KanbanPullRequestStatus, KanbanReviewStatus, KanbanMergeStatus, KanbanCiGateStatus, KanbanPublishStatus, KanbanReviewTargetType, KanbanReviewDecision, KanbanReviewQueueState, KanbanDiffLineKind, KanbanReviewCommentStatus, KanbanReviewCommentSide, KanbanLabel, KanbanAssignee, KanbanAcceptanceCriterion, KanbanIssueDependency, KanbanDecompositionItem, KanbanIssueDispatchState, KanbanIssueSource, KanbanPullRequestReviewLink, KanbanCiGate, KanbanRepositorySettings, KanbanRepositoryContext, KanbanPullRequest, KanbanIssueRepositoryLifecycle, KanbanReviewFeedbackSource, KanbanDiffLine, KanbanDiffHunk, KanbanDiffFile, KanbanReviewCommentAnchor, KanbanReviewComment, KanbanReviewSummary, KanbanReviewArtifact, KanbanReviewQueueItem, KanbanReviewSnapshot, KanbanIssue, KanbanStatusDefinition, KanbanProjectMetrics, LinkedRunSummary, KanbanProject, KanbanBacklogSnapshot, KanbanBoardPolicyHook, KanbanBoardPolicySignal, KanbanBoardMoveTarget, KanbanBoardCard, KanbanBoardColumn, KanbanBoardSwimlane, KanbanProjectBoard, KanbanBoardSnapshot, KanbanIssueMoveEvaluation, KanbanBacklogSummary, KanbanBacklogOverview, KanbanIssueCreateInput, KanbanIssueCreateResult, KanbanIssueMoveInput, KanbanIssueUpdateInput, KanbanIssueWorkspaceRef, KanbanIssueWorkspaceCreateResult, KanbanIssueWorkspaceLinkInput, KanbanWorkspaceStatus, KanbanWorkspaceAction, KanbanWorkspaceSessionSummary, KanbanWorkspaceIssueSummary, KanbanWorkspaceOwnershipProjectSummary, KanbanWorkspaceOwnershipIssueSummary, KanbanWorkspaceOwnershipHostSummary, KanbanWorkspaceOwnershipSummary, KanbanWorkspaceRunSummary, KanbanWorkspaceGitSummary, KanbanWorkspaceNotesSummary, KanbanWorkspaceLinks, KanbanWorkspaceSessionCollection, KanbanWorkspaceRunCollection, KanbanWorkspaceActionAvailability, KanbanWorkspaceSummary, KanbanWorkspaceInventory, KanbanWorkspaceActionResult, KanbanWorkspaceActionResponse, KanbanWorkspaceInventoryQuery, KanbanWorkspaceActionInput, } from './kanban.js';
|
|
45
|
+
export { normalizeKanbanIssue, resolveKanbanWorkflowState, resolveKanbanSwimlane, resolveKanbanStatusForWorkflowState, summarizeKanbanReviewArtifact, evaluateKanbanIssueMove, computeKanbanProjectMetrics, buildKanbanBacklogSnapshot, buildKanbanProjectBoard, buildKanbanBoardSnapshot, upsertKanbanProjectRepository, updateKanbanProjectRepositorySettings, linkKanbanIssueRepository, createKanbanIssuePullRequest, } from './kanban.js';
|
|
46
|
+
export type { AutomationRuleLifecycleState, AutomationRuleSourceMetadata, AutomationRuleAuditMetadata, AutomationTaskTemplate, AutomationTarget, AutomationIssueCreateRoute, AutomationDerivedBoardRoute, AutomationRouting, TimerAutomationTrigger, WebhookAutomationTrigger, TimerAutomationRule, WebhookAutomationRule, AutomationRule, AutomationExecutionStatus, AutomationExecutionRecord, } from './automation.js';
|
|
47
|
+
export type { AuthMethod, AuthMethodDescriptor, AuthState, AuthSetupGuidance, AuthSetupStep, AuthEnvVar, } from './auth-types.js';
|
|
48
|
+
export type { AgentConfig, AgentConfigSchema, ConfigField, ValidationResult, ConfigValidationError, ConfigValidationWarning, ModelSelection, } from './config-types.js';
|
|
49
|
+
export type { SpawnArgs, ParseContext, InstalledAgentInfo, AgentAdapterInfo, AgentAdapter as LegacyAgentAdapter, DetectInstallationResult, InstallResult, AdapterInstallOptions, AdapterUpdateOptions, Spawner, SubprocessAdapter, RemoteAdapter, ProgrammaticAdapter, RemoteConnection, HttpConnection, WebSocketConnection, WebSocketMessage, ServerOptions, ServerInfo, ServerHealth, ServerManager, MultiAgentAdapter, AgentAdapter, isSubprocessAdapter, isRemoteAdapter, isProgrammaticAdapter, isHttpConnection, isWebSocketConnection, } from './adapter.js';
|
|
50
|
+
export type { AdapterRegistry } from './adapter-registry.js';
|
|
51
|
+
export { AdapterRegistryImpl } from './adapter-registry.js';
|
|
52
|
+
export type { ModelRegistry, ModelCatalogEntry } from './model-registry.js';
|
|
53
|
+
export { ModelRegistryImpl } from './model-registry.js';
|
|
54
|
+
export type { SessionManager } from './session-manager.js';
|
|
55
|
+
export { SessionManagerImpl } from './session-manager.js';
|
|
56
|
+
export type { ConfigManager } from './config-manager.js';
|
|
57
|
+
export { ConfigManagerImpl } from './config-manager.js';
|
|
58
|
+
export type { AuthManager } from './auth-manager.js';
|
|
59
|
+
export type { AuthMethodType, FullAuthState, FullAuthSetupGuidance, } from './auth-manager.js';
|
|
60
|
+
export { AuthManagerImpl } from './auth-manager.js';
|
|
61
|
+
export type { InstalledPlugin, InstalledPlugin as PluginInfo, PluginInstallOptions, PluginSearchOptions, PluginListing, PluginDetail, PluginBrowseOptions, } from './plugin-types.js';
|
|
62
|
+
export type { PluginManager } from './plugin-manager.js';
|
|
63
|
+
export { PluginManagerImpl } from './plugin-manager-impl.js';
|
|
64
|
+
export type { HostHarnessInfo, HostSignalMap, HostMetadataReader, HostMetadataMap, DetectHostHarnessOptions, } from './host-detection.js';
|
|
65
|
+
export { detectHostHarness, DEFAULT_HOST_SIGNALS, DEFAULT_HOST_METADATA } from './host-detection.js';
|
|
66
|
+
export type { ClientOptions, } from './client.js';
|
|
67
|
+
export { AgentMuxClient, createClient } from './client.js';
|
|
68
|
+
export type { UnifiedHookPayload, UnifiedHookResult, HookRegistration, HookScope, } from './hooks.js';
|
|
69
|
+
export { HookConfigManager } from './hooks.js';
|
|
70
|
+
export type { BuiltInHookFn, BuiltInHookEntry } from './builtin-hooks.js';
|
|
71
|
+
export { BuiltInHooksRegistry, builtInHooks } from './builtin-hooks.js';
|
|
72
|
+
export type { DispatchOptions } from './hook-dispatcher.js';
|
|
73
|
+
export { HookDispatcher } from './hook-dispatcher.js';
|
|
74
|
+
export type { HookTypeEntry } from './hook-catalog.js';
|
|
75
|
+
export { HOOK_CATALOG, getHookCatalog, isKnownHookType } from './hook-catalog.js';
|
|
76
|
+
export { parseHookPayload, formatHookResult } from './hook-payload.js';
|
|
77
|
+
export type { AtomicWriteOptions } from './atomic-fs.js';
|
|
78
|
+
export { writeFileAtomic, writeJsonAtomic } from './atomic-fs.js';
|
|
79
|
+
export type { BaseAgentAdapterInterface, ProgrammaticRun } from './adapter-types.js';
|
|
80
|
+
export type { ProviderConfig, ProviderId, TransportId, ProviderAuth, ProviderDefaults } from './provider-config.js';
|
|
81
|
+
export { PROVIDER_DEFAULTS, translateModelId, MODEL_TRANSLATION_TABLE } from './provider-config.js';
|
|
82
|
+
export type { ResolveProviderInput } from './provider-resolver.js';
|
|
83
|
+
export { resolveProvider } from './provider-resolver.js';
|
|
84
|
+
export type { ProviderProfilesScope, ProviderProfilesFileOptions, ProvidersFile, ProviderProfileEntry } from './provider-profiles.js';
|
|
85
|
+
export { resolveProvidersFilePath, loadProvidersFile, writeProvidersFile, upsertProviderProfile, updateProviderDefaults, loadProfile, loadProviderDefaults } from './provider-profiles.js';
|
|
86
|
+
export { isNativelySupported, getNativeMechanism, getRequiredProxyTransport, getHarnessDefaultTransport, isTransportCompatible } from './provider-support-matrix.js';
|
|
87
|
+
export type { NativeSupportEntry } from './provider-support-matrix.js';
|
|
88
|
+
export * as schema from './schema/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,gBAAgB,EAChB,SAAS,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