@jshookmcp/jshook 0.2.5 → 0.2.6
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/README.md +5 -5
- package/README.zh.md +5 -5
- package/dist/packages/extension-sdk/src/workflow.d.ts +17 -2
- package/dist/packages/extension-sdk/src/workflow.js +36 -0
- package/dist/src/modules/browser/BrowserPool.d.ts +49 -0
- package/dist/src/modules/browser/BrowserPool.js +288 -0
- package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.d.ts +5 -0
- package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.js +43 -2
- package/dist/src/modules/deobfuscator/Deobfuscator.js +5 -0
- package/dist/src/modules/external/ExternalToolRunner.js +1 -1
- package/dist/src/server/MCPServer.context.d.ts +1 -0
- package/dist/src/server/domains/browser/handlers/stealth-injection.d.ts +1 -0
- package/dist/src/server/domains/browser/handlers/stealth-injection.js +3 -0
- package/dist/src/server/domains/shared-state-board/definitions.d.ts +2 -0
- package/dist/src/server/domains/shared-state-board/definitions.js +78 -0
- package/dist/src/server/domains/shared-state-board/handlers.impl.d.ts +58 -0
- package/dist/src/server/domains/shared-state-board/handlers.impl.js +419 -0
- package/dist/src/server/domains/shared-state-board/index.d.ts +2 -0
- package/dist/src/server/domains/shared-state-board/index.js +2 -0
- package/dist/src/server/domains/shared-state-board/manifest.d.ts +57 -0
- package/dist/src/server/domains/shared-state-board/manifest.js +74 -0
- package/dist/src/server/http/SseStream.d.ts +21 -0
- package/dist/src/server/http/SseStream.js +129 -0
- package/dist/src/server/teams/TeamManager.d.ts +43 -0
- package/dist/src/server/teams/TeamManager.js +238 -0
- package/dist/src/server/teams/index.d.ts +1 -0
- package/dist/src/server/teams/index.js +1 -0
- package/dist/src/server/workflows/WorkflowContract.d.ts +20 -4
- package/dist/src/server/workflows/WorkflowContract.js +40 -0
- package/dist/src/server/workflows/WorkflowEngine.js +190 -13
- package/dist/src/types/deobfuscator.d.ts +1 -0
- package/dist/src/utils/cache/CachedDecorator.d.ts +8 -0
- package/dist/src/utils/cache/CachedDecorator.js +55 -0
- package/dist/src/utils/cache/PersistentCache.d.ts +33 -0
- package/dist/src/utils/cache/PersistentCache.js +246 -0
- package/dist/src/utils/cache/index.d.ts +2 -0
- package/dist/src/utils/cache/index.js +2 -0
- package/package.json +11 -12
- package/scripts/postinstall.cjs +54 -27
- package/workflows/anti-bot-diagnoser/.jshook-install.json +14 -0
- package/workflows/anti-bot-diagnoser/LICENSE +21 -0
- package/workflows/anti-bot-diagnoser/README.md +105 -0
- package/workflows/anti-bot-diagnoser/docs/agent-recipes.md +44 -0
- package/workflows/anti-bot-diagnoser/meta.yaml +6 -0
- package/workflows/anti-bot-diagnoser/package.json +22 -0
- package/workflows/anti-bot-diagnoser/tsconfig.json +15 -0
- package/workflows/anti-bot-diagnoser/workflow.ts +224 -0
- package/workflows/api-openapi-probe/.jshook-install.json +14 -0
- package/workflows/api-openapi-probe/meta.yaml +6 -0
- package/workflows/api-openapi-probe/package.json +22 -0
- package/workflows/api-openapi-probe/pnpm-lock.yaml +819 -0
- package/workflows/api-openapi-probe/tsconfig.json +15 -0
- package/workflows/api-openapi-probe/workflow.ts +40 -0
- package/workflows/api-probe-batch/.jshook-install.json +14 -0
- package/workflows/api-probe-batch/LICENSE +21 -0
- package/workflows/api-probe-batch/README.md +45 -0
- package/workflows/api-probe-batch/meta.yaml +4 -0
- package/workflows/api-probe-batch/package.json +23 -0
- package/workflows/api-probe-batch/tsconfig.json +16 -0
- package/workflows/api-probe-batch/workflow.ts +111 -0
- package/workflows/auth-bootstrap/.jshook-install.json +14 -0
- package/workflows/auth-bootstrap/LICENSE +21 -0
- package/workflows/auth-bootstrap/README.md +74 -0
- package/workflows/auth-bootstrap/meta.yaml +4 -0
- package/workflows/auth-bootstrap/package.json +23 -0
- package/workflows/auth-bootstrap/tsconfig.json +16 -0
- package/workflows/auth-bootstrap/workflow.ts +141 -0
- package/workflows/auth-extract/.jshook-install.json +14 -0
- package/workflows/auth-extract/meta.yaml +6 -0
- package/workflows/auth-extract/package.json +22 -0
- package/workflows/auth-extract/pnpm-lock.yaml +819 -0
- package/workflows/auth-extract/tsconfig.json +15 -0
- package/workflows/auth-extract/workflow.ts +36 -0
- package/workflows/auth-surface-mapper/.jshook-install.json +14 -0
- package/workflows/auth-surface-mapper/meta.yaml +6 -0
- package/workflows/auth-surface-mapper/package.json +22 -0
- package/workflows/auth-surface-mapper/pnpm-lock.yaml +819 -0
- package/workflows/auth-surface-mapper/tsconfig.json +15 -0
- package/workflows/auth-surface-mapper/workflow.ts +104 -0
- package/workflows/batch-register/.jshook-install.json +14 -0
- package/workflows/batch-register/LICENSE +21 -0
- package/workflows/batch-register/README.md +39 -0
- package/workflows/batch-register/meta.yaml +4 -0
- package/workflows/batch-register/package.json +23 -0
- package/workflows/batch-register/tsconfig.json +16 -0
- package/workflows/batch-register/workflow.ts +67 -0
- package/workflows/bundle-recovery/.jshook-install.json +14 -0
- package/workflows/bundle-recovery/LICENSE +21 -0
- package/workflows/bundle-recovery/README.md +105 -0
- package/workflows/bundle-recovery/docs/agent-recipes.md +44 -0
- package/workflows/bundle-recovery/meta.yaml +6 -0
- package/workflows/bundle-recovery/package.json +22 -0
- package/workflows/bundle-recovery/tsconfig.json +15 -0
- package/workflows/bundle-recovery/workflow.ts +179 -0
- package/workflows/challenge-detector/.jshook-install.json +14 -0
- package/workflows/challenge-detector/meta.yaml +14 -0
- package/workflows/challenge-detector/package.json +22 -0
- package/workflows/challenge-detector/pnpm-lock.yaml +819 -0
- package/workflows/challenge-detector/tsconfig.json +15 -0
- package/workflows/challenge-detector/workflow.ts +298 -0
- package/workflows/deobfuscation-pipeline/.jshook-install.json +14 -0
- package/workflows/deobfuscation-pipeline/meta.yaml +6 -0
- package/workflows/deobfuscation-pipeline/package.json +22 -0
- package/workflows/deobfuscation-pipeline/pnpm-lock.yaml +819 -0
- package/workflows/deobfuscation-pipeline/tsconfig.json +15 -0
- package/workflows/deobfuscation-pipeline/workflow.ts +119 -0
- package/workflows/electron-bridge-mapper/.jshook-install.json +14 -0
- package/workflows/electron-bridge-mapper/meta.yaml +6 -0
- package/workflows/electron-bridge-mapper/package.json +22 -0
- package/workflows/electron-bridge-mapper/pnpm-lock.yaml +819 -0
- package/workflows/electron-bridge-mapper/tsconfig.json +15 -0
- package/workflows/electron-bridge-mapper/workflow.ts +125 -0
- package/workflows/evidence-pack/.jshook-install.json +14 -0
- package/workflows/evidence-pack/LICENSE +21 -0
- package/workflows/evidence-pack/README.md +105 -0
- package/workflows/evidence-pack/docs/agent-recipes.md +44 -0
- package/workflows/evidence-pack/meta.yaml +6 -0
- package/workflows/evidence-pack/package.json +22 -0
- package/workflows/evidence-pack/tsconfig.json +15 -0
- package/workflows/evidence-pack/workflow.ts +154 -0
- package/workflows/js-bundle-search/.jshook-install.json +14 -0
- package/workflows/js-bundle-search/LICENSE +21 -0
- package/workflows/js-bundle-search/README.md +46 -0
- package/workflows/js-bundle-search/meta.yaml +4 -0
- package/workflows/js-bundle-search/package.json +23 -0
- package/workflows/js-bundle-search/tsconfig.json +16 -0
- package/workflows/js-bundle-search/workflow.ts +118 -0
- package/workflows/protocol-registry/.jshook-install.json +14 -0
- package/workflows/protocol-registry/meta.yaml +6 -0
- package/workflows/protocol-registry/package.json +22 -0
- package/workflows/protocol-registry/pnpm-lock.yaml +819 -0
- package/workflows/protocol-registry/tsconfig.json +15 -0
- package/workflows/protocol-registry/workflow.ts +107 -0
- package/workflows/qwen-mail-open-latest/meta.yaml +7 -0
- package/workflows/qwen-mail-open-latest/package.json +22 -0
- package/workflows/qwen-mail-open-latest/pnpm-lock.yaml +819 -0
- package/workflows/qwen-mail-open-latest/tsconfig.json +15 -0
- package/workflows/qwen-mail-open-latest/workflow.ts +77 -0
- package/workflows/register-account-flow/.jshook-install.json +14 -0
- package/workflows/register-account-flow/LICENSE +21 -0
- package/workflows/register-account-flow/README.md +64 -0
- package/workflows/register-account-flow/meta.yaml +4 -0
- package/workflows/register-account-flow/package.json +23 -0
- package/workflows/register-account-flow/tsconfig.json +16 -0
- package/workflows/register-account-flow/workflow.ts +127 -0
- package/workflows/replay-lab/.jshook-install.json +14 -0
- package/workflows/replay-lab/meta.yaml +6 -0
- package/workflows/replay-lab/package.json +22 -0
- package/workflows/replay-lab/pnpm-lock.yaml +819 -0
- package/workflows/replay-lab/tsconfig.json +15 -0
- package/workflows/replay-lab/workflow.ts +106 -0
- package/workflows/script-evidence-scan/.jshook-install.json +14 -0
- package/workflows/script-evidence-scan/LICENSE +21 -0
- package/workflows/script-evidence-scan/README.md +61 -0
- package/workflows/script-evidence-scan/meta.yaml +4 -0
- package/workflows/script-evidence-scan/package.json +23 -0
- package/workflows/script-evidence-scan/tsconfig.json +16 -0
- package/workflows/script-evidence-scan/workflow.ts +89 -0
- package/workflows/signature-hunter/.jshook-install.json +14 -0
- package/workflows/signature-hunter/LICENSE +21 -0
- package/workflows/signature-hunter/README.md +105 -0
- package/workflows/signature-hunter/docs/agent-recipes.md +44 -0
- package/workflows/signature-hunter/meta.yaml +6 -0
- package/workflows/signature-hunter/package.json +22 -0
- package/workflows/signature-hunter/tsconfig.json +15 -0
- package/workflows/signature-hunter/workflow.ts +170 -0
- package/workflows/signing-lineage/.jshook-install.json +14 -0
- package/workflows/signing-lineage/meta.yaml +6 -0
- package/workflows/signing-lineage/package.json +22 -0
- package/workflows/signing-lineage/pnpm-lock.yaml +819 -0
- package/workflows/signing-lineage/tsconfig.json +15 -0
- package/workflows/signing-lineage/workflow.ts +120 -0
- package/workflows/temp-mail-extract-link/.jshook-install.json +14 -0
- package/workflows/temp-mail-extract-link/LICENSE +21 -0
- package/workflows/temp-mail-extract-link/README.md +71 -0
- package/workflows/temp-mail-extract-link/meta.yaml +4 -0
- package/workflows/temp-mail-extract-link/package.json +23 -0
- package/workflows/temp-mail-extract-link/tsconfig.json +16 -0
- package/workflows/temp-mail-extract-link/workflow.ts +221 -0
- package/workflows/temp-mail-open-latest/.jshook-install.json +14 -0
- package/workflows/temp-mail-open-latest/LICENSE +21 -0
- package/workflows/temp-mail-open-latest/README.md +61 -0
- package/workflows/temp-mail-open-latest/meta.yaml +4 -0
- package/workflows/temp-mail-open-latest/package.json +23 -0
- package/workflows/temp-mail-open-latest/tsconfig.json +16 -0
- package/workflows/temp-mail-open-latest/workflow.ts +136 -0
- package/workflows/template/.jshook-install.json +14 -0
- package/workflows/template/LICENSE +21 -0
- package/workflows/template/README.md +45 -0
- package/workflows/template/docs/SKILL.md +111 -0
- package/workflows/template/meta.yaml +6 -0
- package/workflows/template/package.json +22 -0
- package/workflows/template/pnpm-lock.yaml +819 -0
- package/workflows/template/tsconfig.json +15 -0
- package/workflows/template/workflow.ts +73 -0
- package/workflows/web-api-capture-session/.jshook-install.json +14 -0
- package/workflows/web-api-capture-session/LICENSE +21 -0
- package/workflows/web-api-capture-session/README.md +64 -0
- package/workflows/web-api-capture-session/meta.yaml +4 -0
- package/workflows/web-api-capture-session/package.json +23 -0
- package/workflows/web-api-capture-session/tsconfig.json +16 -0
- package/workflows/web-api-capture-session/workflow.ts +124 -0
- package/workflows/ws-protocol-lifter/.jshook-install.json +14 -0
- package/workflows/ws-protocol-lifter/LICENSE +21 -0
- package/workflows/ws-protocol-lifter/README.md +105 -0
- package/workflows/ws-protocol-lifter/docs/agent-recipes.md +44 -0
- package/workflows/ws-protocol-lifter/meta.yaml +6 -0
- package/workflows/ws-protocol-lifter/package.json +22 -0
- package/workflows/ws-protocol-lifter/tsconfig.json +15 -0
- package/workflows/ws-protocol-lifter/workflow.ts +163 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"noEmit": false,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"rootDir": ".",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"types": ["node"]
|
|
12
|
+
},
|
|
13
|
+
"include": ["workflow.ts"],
|
|
14
|
+
"exclude": ["dist", "node_modules"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkflow,
|
|
3
|
+
type WorkflowExecutionContext,
|
|
4
|
+
SequenceNodeBuilder,
|
|
5
|
+
toolNode,
|
|
6
|
+
} from '@jshookmcp/extension-sdk/workflow';
|
|
7
|
+
|
|
8
|
+
const workflowId = 'workflow.template-capture.v1';
|
|
9
|
+
|
|
10
|
+
export default createWorkflow(workflowId, 'Template Capture Workflow')
|
|
11
|
+
.description(
|
|
12
|
+
'TypeScript-first MVP workflow that enables network capture, navigates to a page, collects surface data in parallel, extracts auth, and emits a summary.',
|
|
13
|
+
)
|
|
14
|
+
.tags(['workflow', 'template', 'parallel', 'capture'])
|
|
15
|
+
.timeoutMs(10 * 60_000)
|
|
16
|
+
.defaultMaxConcurrency(4)
|
|
17
|
+
.buildGraph((ctx: WorkflowExecutionContext) => {
|
|
18
|
+
const prefix = 'workflows.templateCapture';
|
|
19
|
+
const url = String(ctx.getConfig(`${prefix}.url`, 'https://example.com'));
|
|
20
|
+
const waitUntil = String(ctx.getConfig(`${prefix}.waitUntil`, 'domcontentloaded'));
|
|
21
|
+
const requestTail = Number(ctx.getConfig(`${prefix}.requestTail`, 20));
|
|
22
|
+
const maxConcurrency = Number(ctx.getConfig(`${prefix}.parallel.maxConcurrency`, 4));
|
|
23
|
+
const collectConsoleLogs = Boolean(ctx.getConfig(`${prefix}.collectConsoleLogs`, true));
|
|
24
|
+
const logLimit = Number(ctx.getConfig(`${prefix}.consoleLogLimit`, 50));
|
|
25
|
+
|
|
26
|
+
const root = new SequenceNodeBuilder('template-capture-root');
|
|
27
|
+
|
|
28
|
+
root
|
|
29
|
+
.tool('enable-network', 'network_enable', { input: { enableExceptions: true } })
|
|
30
|
+
.tool('navigate', 'page_navigate', { input: { url, waitUntil } })
|
|
31
|
+
.parallel('collect-surface', (p) => {
|
|
32
|
+
p.maxConcurrency(maxConcurrency)
|
|
33
|
+
.failFast(false)
|
|
34
|
+
.tool('collect-local-storage', 'page_get_local_storage')
|
|
35
|
+
.tool('collect-cookies', 'page_get_cookies')
|
|
36
|
+
.tool('collect-requests', 'network_get_requests', { input: { tail: requestTail } })
|
|
37
|
+
.tool('collect-links', 'page_get_all_links');
|
|
38
|
+
|
|
39
|
+
if (collectConsoleLogs) {
|
|
40
|
+
p.tool('collect-console-logs', 'console_get_logs', { input: { limit: logLimit } });
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.tool('extract-auth', 'network_extract_auth', { input: { minConfidence: 0.4 } })
|
|
44
|
+
.tool('emit-summary', 'console_execute', {
|
|
45
|
+
input: {
|
|
46
|
+
expression: `(${JSON.stringify({
|
|
47
|
+
status: 'template_capture_complete',
|
|
48
|
+
workflowId,
|
|
49
|
+
url,
|
|
50
|
+
waitUntil,
|
|
51
|
+
requestTail,
|
|
52
|
+
maxConcurrency,
|
|
53
|
+
collectConsoleLogs,
|
|
54
|
+
})})`,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return root;
|
|
59
|
+
})
|
|
60
|
+
.onStart((ctx) => {
|
|
61
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, stage: 'start' });
|
|
62
|
+
})
|
|
63
|
+
.onFinish((ctx) => {
|
|
64
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, stage: 'finish' });
|
|
65
|
+
})
|
|
66
|
+
.onError((ctx, error) => {
|
|
67
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', {
|
|
68
|
+
workflowId,
|
|
69
|
+
stage: 'error',
|
|
70
|
+
error: error.name,
|
|
71
|
+
});
|
|
72
|
+
})
|
|
73
|
+
.build();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "web-api-capture-session",
|
|
5
|
+
"id": "workflow.web-api-capture-session.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_web_api_capture_session",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "087d1ee8d1724b11df0a13b3efb699e8edf71fdd",
|
|
11
|
+
"subpath": ".",
|
|
12
|
+
"entry": "workflow.ts"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vmoranv
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# web-api-capture-session workflow
|
|
2
|
+
|
|
3
|
+
Declarative workflow for full-chain web API capture: navigate to a target page, optionally replay interaction steps, collect network activity, extract auth signals, and optionally export HAR output.
|
|
4
|
+
|
|
5
|
+
## Entry File
|
|
6
|
+
|
|
7
|
+
- `workflow.ts`
|
|
8
|
+
|
|
9
|
+
## Workflow ID
|
|
10
|
+
|
|
11
|
+
- `workflow.web-api-capture-session.v1`
|
|
12
|
+
|
|
13
|
+
## Structure
|
|
14
|
+
|
|
15
|
+
This workflow translates the built-in `handleWebApiCaptureSession` orchestration into a declarative graph:
|
|
16
|
+
|
|
17
|
+
- `network_enable` to start request and exception capture
|
|
18
|
+
- `console_inject_fetch_interceptor` and `console_inject_xhr_interceptor` to persist frontend traffic
|
|
19
|
+
- `page_navigate` to load the target page
|
|
20
|
+
- Optional action branches for `page_click`, `page_type`, and `page_evaluate`
|
|
21
|
+
- `page_evaluate` delay step to let async requests settle
|
|
22
|
+
- `network_get_stats` and `network_get_requests` for request collection
|
|
23
|
+
- `network_extract_auth` for auth/token discovery
|
|
24
|
+
- Optional `network_export_har` branch for artifact export
|
|
25
|
+
- `console_execute` summary step for downstream runners
|
|
26
|
+
|
|
27
|
+
## Tools Used
|
|
28
|
+
|
|
29
|
+
- `network_enable`
|
|
30
|
+
- `console_inject_fetch_interceptor`
|
|
31
|
+
- `console_inject_xhr_interceptor`
|
|
32
|
+
- `page_navigate`
|
|
33
|
+
- `page_click`
|
|
34
|
+
- `page_type`
|
|
35
|
+
- `page_evaluate`
|
|
36
|
+
- `network_get_stats`
|
|
37
|
+
- `network_get_requests`
|
|
38
|
+
- `network_extract_auth`
|
|
39
|
+
- `network_export_har`
|
|
40
|
+
- `console_execute`
|
|
41
|
+
|
|
42
|
+
## Config
|
|
43
|
+
|
|
44
|
+
- `workflows.webApiCapture.url`
|
|
45
|
+
- `workflows.webApiCapture.waitUntil`
|
|
46
|
+
- `workflows.webApiCapture.enableClickStep`
|
|
47
|
+
- `workflows.webApiCapture.clickSelector`
|
|
48
|
+
- `workflows.webApiCapture.enableTypeStep`
|
|
49
|
+
- `workflows.webApiCapture.typeSelector`
|
|
50
|
+
- `workflows.webApiCapture.typeText`
|
|
51
|
+
- `workflows.webApiCapture.enableEvaluateStep`
|
|
52
|
+
- `workflows.webApiCapture.evaluateExpression`
|
|
53
|
+
- `workflows.webApiCapture.waitAfterActionsMs`
|
|
54
|
+
- `workflows.webApiCapture.exportHar`
|
|
55
|
+
- `workflows.webApiCapture.harOutputPath`
|
|
56
|
+
|
|
57
|
+
## Local Validation
|
|
58
|
+
|
|
59
|
+
1. Run `pnpm install`.
|
|
60
|
+
2. Run `pnpm typecheck`.
|
|
61
|
+
3. Put this repo under a configured `workflows/` extension root.
|
|
62
|
+
4. Run `extensions_reload` in `jshookmcp`.
|
|
63
|
+
5. Confirm the workflow appears in `extensions_list`.
|
|
64
|
+
6. Execute the workflow with your runner and verify request capture, auth extraction, and optional HAR export.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jshookmcpextension/workflow-web-api-capture-session",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"build": "tsc -p tsconfig.json",
|
|
5
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@jshookmcp/extension-sdk": "^0.3.0",
|
|
10
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
11
|
+
"dotenv": "^17.3.1"
|
|
12
|
+
},
|
|
13
|
+
"version": "0.1.0",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^25.3.0",
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
|
+
},
|
|
21
|
+
"private": true,
|
|
22
|
+
"packageManager": "pnpm@10.28.2"
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"rootDir": ".",
|
|
12
|
+
"outDir": "dist"
|
|
13
|
+
},
|
|
14
|
+
"include": ["workflow.ts"],
|
|
15
|
+
"exclude": ["dist", "node_modules"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkflow,
|
|
3
|
+
type WorkflowExecutionContext,
|
|
4
|
+
SequenceNodeBuilder,
|
|
5
|
+
} from '@jshookmcp/extension-sdk/workflow';
|
|
6
|
+
|
|
7
|
+
const workflowId = 'workflow.web-api-capture-session.v1';
|
|
8
|
+
|
|
9
|
+
function isoTimestampForFile(): string {
|
|
10
|
+
return new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default createWorkflow(workflowId, 'Web API Capture Session')
|
|
14
|
+
.description(
|
|
15
|
+
'Delegate to the built-in web_api_capture_session tool using only valid action types (click/type/wait/evaluate), then emit a concise summary.',
|
|
16
|
+
)
|
|
17
|
+
.tags(['workflow', 'capture', 'network', 'auth', 'har', 'reverse'])
|
|
18
|
+
.timeoutMs(10 * 60_000)
|
|
19
|
+
.defaultMaxConcurrency(1)
|
|
20
|
+
.buildGraph((ctx) => {
|
|
21
|
+
const prefix = 'workflows.webApiCapture';
|
|
22
|
+
const url = ctx.getConfig<string>(`${prefix}.url`, 'https://example.com');
|
|
23
|
+
const waitUntil = ctx.getConfig<string>(`${prefix}.waitUntil`, 'domcontentloaded');
|
|
24
|
+
const waitAfterActionsMs = ctx.getConfig<number>(`${prefix}.waitAfterActionsMs`, 1500);
|
|
25
|
+
|
|
26
|
+
const enableTypeStep = ctx.getConfig<boolean>(`${prefix}.enableTypeStep`, false);
|
|
27
|
+
const typeSelector = ctx.getConfig<string>(`${prefix}.typeSelector`, "input[name='query']");
|
|
28
|
+
const typeText = ctx.getConfig<string>(`${prefix}.typeText`, 'capture me');
|
|
29
|
+
|
|
30
|
+
const enableClickStep = ctx.getConfig<boolean>(`${prefix}.enableClickStep`, false);
|
|
31
|
+
const clickSelector = ctx.getConfig<string>(`${prefix}.clickSelector`, 'button[data-capture]');
|
|
32
|
+
|
|
33
|
+
const enableWaitStep = ctx.getConfig<boolean>(`${prefix}.enableWaitStep`, false);
|
|
34
|
+
const waitSelector = ctx.getConfig<string>(`${prefix}.waitSelector`, '');
|
|
35
|
+
const waitText = ctx.getConfig<string>(`${prefix}.waitText`, '');
|
|
36
|
+
const waitDelayMs = ctx.getConfig<number>(`${prefix}.waitDelayMs`, 0);
|
|
37
|
+
|
|
38
|
+
const enableEvaluateStep = ctx.getConfig<boolean>(`${prefix}.enableEvaluateStep`, false);
|
|
39
|
+
const evaluateExpression = ctx.getConfig<string>(
|
|
40
|
+
`${prefix}.evaluateExpression`,
|
|
41
|
+
'window.__captureProbe = true',
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const exportHar = ctx.getConfig<boolean>(`${prefix}.exportHar`, true);
|
|
45
|
+
const exportReport = ctx.getConfig<boolean>(`${prefix}.exportReport`, false);
|
|
46
|
+
const harOutputPath = ctx.getConfig<string>(
|
|
47
|
+
`${prefix}.harOutputPath`,
|
|
48
|
+
`workflow-smoke-capture-${isoTimestampForFile()}.har`,
|
|
49
|
+
);
|
|
50
|
+
const reportOutputPath = ctx.getConfig<string>(
|
|
51
|
+
`${prefix}.reportOutputPath`,
|
|
52
|
+
`workflow-smoke-capture-report-${isoTimestampForFile()}.md`,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const actions: Array<Record<string, unknown>> = [];
|
|
56
|
+
if (enableTypeStep) {
|
|
57
|
+
actions.push({ type: 'type', selector: typeSelector, text: typeText });
|
|
58
|
+
}
|
|
59
|
+
if (enableClickStep) {
|
|
60
|
+
actions.push({ type: 'click', selector: clickSelector });
|
|
61
|
+
}
|
|
62
|
+
if (enableWaitStep) {
|
|
63
|
+
const waitAction: Record<string, unknown> = { type: 'wait' };
|
|
64
|
+
if (waitSelector) waitAction['selector'] = waitSelector;
|
|
65
|
+
if (waitText) waitAction['text'] = waitText;
|
|
66
|
+
if (waitDelayMs > 0) waitAction['delayMs'] = waitDelayMs;
|
|
67
|
+
actions.push(waitAction);
|
|
68
|
+
}
|
|
69
|
+
if (enableEvaluateStep) {
|
|
70
|
+
actions.push({ type: 'evaluate', expression: evaluateExpression });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const root = new SequenceNodeBuilder('web-api-capture-session-root');
|
|
74
|
+
|
|
75
|
+
root.tool('capture-session', 'web_api_capture_session', {
|
|
76
|
+
input: {
|
|
77
|
+
url,
|
|
78
|
+
waitUntil,
|
|
79
|
+
actions,
|
|
80
|
+
waitAfterActionsMs,
|
|
81
|
+
exportHar,
|
|
82
|
+
exportReport,
|
|
83
|
+
harOutputPath,
|
|
84
|
+
reportOutputPath,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
root.tool('capture-summary', 'console_execute', {
|
|
89
|
+
input: {
|
|
90
|
+
expression: `(${JSON.stringify({
|
|
91
|
+
status: 'web_api_capture_sequence_complete',
|
|
92
|
+
workflowId,
|
|
93
|
+
url,
|
|
94
|
+
waitUntil,
|
|
95
|
+
actions,
|
|
96
|
+
exportHar,
|
|
97
|
+
exportReport,
|
|
98
|
+
harOutputPath,
|
|
99
|
+
reportOutputPath,
|
|
100
|
+
})})`,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return root;
|
|
105
|
+
})
|
|
106
|
+
.onStart((ctx) => {
|
|
107
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', {
|
|
108
|
+
workflowId,
|
|
109
|
+
stage: 'start',
|
|
110
|
+
});
|
|
111
|
+
})
|
|
112
|
+
.onFinish((ctx) => {
|
|
113
|
+
ctx.emitMetric('workflow_runs_total', 1, 'counter', {
|
|
114
|
+
workflowId,
|
|
115
|
+
stage: 'finish',
|
|
116
|
+
});
|
|
117
|
+
})
|
|
118
|
+
.onError((ctx, error) => {
|
|
119
|
+
ctx.emitMetric('workflow_errors_total', 1, 'counter', {
|
|
120
|
+
workflowId,
|
|
121
|
+
error: error.name,
|
|
122
|
+
});
|
|
123
|
+
})
|
|
124
|
+
.build();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"kind": "workflow",
|
|
4
|
+
"slug": "ws-protocol-lifter",
|
|
5
|
+
"id": "workflow.ws-protocol-lifter.v1",
|
|
6
|
+
"source": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"repo": "https://github.com/vmoranv/jshook_workflow_ws_protocol_lifter",
|
|
9
|
+
"ref": "main",
|
|
10
|
+
"commit": "423d61d2b0f678e7a6cdffe39c73b2d9bbd385ad",
|
|
11
|
+
"subpath": ".",
|
|
12
|
+
"entry": "workflow.ts"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vmoranv
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# jshook_workflow_template
|
|
2
|
+
|
|
3
|
+
TypeScript-first template repository for building a reusable `jshook` workflow.
|
|
4
|
+
|
|
5
|
+
This template focuses on one thing:
|
|
6
|
+
|
|
7
|
+
- codify an existing built-in tool chain into a reusable workflow contract
|
|
8
|
+
- keep TypeScript source in Git and generated JavaScript out of Git
|
|
9
|
+
|
|
10
|
+
## Included in the template
|
|
11
|
+
|
|
12
|
+
- `workflow.ts`: workflow source entrypoint
|
|
13
|
+
- `docs/agent-recipes.md`: recipes for orchestration, parallel reads, and subagent-assisted analysis
|
|
14
|
+
- `dist/workflow.js`: generated locally by `pnpm run build` and ignored by Git
|
|
15
|
+
|
|
16
|
+
## What the MVP workflow demonstrates
|
|
17
|
+
|
|
18
|
+
The sample workflow runs this shape:
|
|
19
|
+
|
|
20
|
+
1. `network_enable`
|
|
21
|
+
2. `page_navigate`
|
|
22
|
+
3. parallel surface collection
|
|
23
|
+
- `page_get_local_storage`
|
|
24
|
+
- `page_get_cookies`
|
|
25
|
+
- `network_get_requests`
|
|
26
|
+
- `page_get_all_links`
|
|
27
|
+
- optional `console_get_logs`
|
|
28
|
+
4. `network_extract_auth`
|
|
29
|
+
5. `console_execute` summary output
|
|
30
|
+
|
|
31
|
+
## Dependency model
|
|
32
|
+
|
|
33
|
+
This template uses the published npm package:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"@jshookmcp/extension-sdk": "^0.1.3"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Install and build
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm install
|
|
45
|
+
pnpm run build
|
|
46
|
+
pnpm run check
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Loading behavior
|
|
50
|
+
|
|
51
|
+
`jshook` discovers both `workflow.ts` and `dist/workflow.js`, but when both exist it prefers the generated JavaScript entry.
|
|
52
|
+
|
|
53
|
+
Recommended workflow:
|
|
54
|
+
|
|
55
|
+
1. edit `workflow.ts`
|
|
56
|
+
2. run `pnpm run build`
|
|
57
|
+
3. let `jshook` load `dist/workflow.js`
|
|
58
|
+
|
|
59
|
+
Do **not** commit `dist/`.
|
|
60
|
+
|
|
61
|
+
## Load the workflow into jshook
|
|
62
|
+
|
|
63
|
+
Set:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
MCP_WORKFLOW_ROOTS=<path-to-cloned-jshook_workflow_template>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then run inside `jshook`:
|
|
70
|
+
|
|
71
|
+
1. `extensions_reload`
|
|
72
|
+
2. `extensions_list`
|
|
73
|
+
3. `list_extension_workflows`
|
|
74
|
+
4. `run_extension_workflow`
|
|
75
|
+
|
|
76
|
+
## Configuration prefix
|
|
77
|
+
|
|
78
|
+
The template uses:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
workflows.templateCapture.*
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Rename that prefix early when adapting the template for real use.
|
|
85
|
+
|
|
86
|
+
## Git hygiene
|
|
87
|
+
|
|
88
|
+
Keep this repo focused on source and docs.
|
|
89
|
+
Do not commit:
|
|
90
|
+
|
|
91
|
+
- `dist/`
|
|
92
|
+
- `node_modules/`
|
|
93
|
+
- `.env`
|
|
94
|
+
- runtime artifacts
|
|
95
|
+
- screenshots
|
|
96
|
+
- local sessions
|
|
97
|
+
- host-specific temp output
|
|
98
|
+
|
|
99
|
+
## What to change first
|
|
100
|
+
|
|
101
|
+
1. replace `workflowId` and `displayName`
|
|
102
|
+
2. rename the config prefix
|
|
103
|
+
3. keep state-mutating steps serialized
|
|
104
|
+
4. keep read-only collection steps parallel where safe
|
|
105
|
+
5. validate the workflow through `extensions_reload` and `list_extension_workflows`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Agent Recipes for `jshook_workflow_template`
|
|
2
|
+
|
|
3
|
+
## Core rule
|
|
4
|
+
|
|
5
|
+
- parallelize reads, not shared page state mutations
|
|
6
|
+
- let the main agent keep the active browser session
|
|
7
|
+
- use subagents for sidecar analysis and report drafting
|
|
8
|
+
|
|
9
|
+
## Recipe 1: run workflow, then delegate analysis
|
|
10
|
+
|
|
11
|
+
Recommended split:
|
|
12
|
+
|
|
13
|
+
- main agent
|
|
14
|
+
- `run_extension_workflow`
|
|
15
|
+
- optional `network_get_response_body`
|
|
16
|
+
- subagent
|
|
17
|
+
- classify endpoints
|
|
18
|
+
- summarize auth and session artifacts
|
|
19
|
+
- draft report output
|
|
20
|
+
|
|
21
|
+
## Recipe 2: main agent navigates, subagent reviews outputs
|
|
22
|
+
|
|
23
|
+
Recommended split:
|
|
24
|
+
|
|
25
|
+
- main agent
|
|
26
|
+
- `page_navigate`
|
|
27
|
+
- page actions
|
|
28
|
+
- `network_get_requests`
|
|
29
|
+
- subagent
|
|
30
|
+
- endpoint matrix
|
|
31
|
+
- auth header and signature review
|
|
32
|
+
- next-step probing suggestions
|
|
33
|
+
|
|
34
|
+
## Recipe 3: when to use parallel tool calls
|
|
35
|
+
|
|
36
|
+
Good read-only candidates:
|
|
37
|
+
|
|
38
|
+
- `extensions_list`
|
|
39
|
+
- `search_tools`
|
|
40
|
+
- `page_get_local_storage`
|
|
41
|
+
- `page_get_cookies`
|
|
42
|
+
- `console_get_logs`
|
|
43
|
+
|
|
44
|
+
Avoid parallelizing any action that changes the current page state.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jshook-workflow-template",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Standalone template repository for building jshook workflows.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"packageManager": "pnpm@10.28.2",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc -p tsconfig.json",
|
|
10
|
+
"check": "tsc -p tsconfig.json --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@jshookmcp/extension-sdk": "^0.3.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^25.3.0",
|
|
17
|
+
"typescript": "^5.9.3"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20.0.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"noEmit": false,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"rootDir": ".",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"types": ["node"]
|
|
12
|
+
},
|
|
13
|
+
"include": ["workflow.ts"],
|
|
14
|
+
"exclude": ["dist", "node_modules"]
|
|
15
|
+
}
|