@epsilon-asi/actors 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/package.json +12 -3
  2. package/.ai/generators/_template.ts +0 -37
  3. package/.ai/generators/abstract.ts +0 -24
  4. package/.ai/generators/actor-task-form-filler.ts +0 -140
  5. package/.ai/generators/actor-task.ts +0 -122
  6. package/.ai/generators/auth-core.ts +0 -126
  7. package/.ai/generators/browser-runtime.ts +0 -114
  8. package/.ai/generators/cli-command.ts +0 -96
  9. package/.ai/generators/core-framework.ts +0 -80
  10. package/.ai/generators/docs.ts +0 -92
  11. package/.ai/generators/error-logging.ts +0 -102
  12. package/.ai/generators/extraction-helper.ts +0 -96
  13. package/.ai/generators/interaction-behavior.ts +0 -129
  14. package/.ai/generators/site-actor.ts +0 -125
  15. package/.ai/generators/site-login-flow.ts +0 -117
  16. package/.ai/generators/unit-test.ts +0 -109
  17. package/.ai/workflows/_template.ts +0 -20
  18. package/.ai/workflows/starter.ts +0 -20
  19. package/ai-gen.config.ts +0 -67
  20. package/src/auth/AuthStateDetector.ts +0 -18
  21. package/src/auth/CredentialsProvider.ts +0 -48
  22. package/src/auth/LoginFlow.ts +0 -332
  23. package/src/auth/LoginFlow.types.ts +0 -141
  24. package/src/auth/SessionStore.ts +0 -21
  25. package/src/auth/index.ts +0 -5
  26. package/src/browser/BrowserFactory.ts +0 -253
  27. package/src/browser/BrowserSession.ts +0 -50
  28. package/src/browser/PuppeteerLike.ts +0 -65
  29. package/src/browser/RuntimeConfig.ts +0 -152
  30. package/src/browser/index.ts +0 -5
  31. package/src/browser/profileValidation.ts +0 -73
  32. package/src/cli/run.ts +0 -112
  33. package/src/core/Actor.ts +0 -167
  34. package/src/core/ActorContext.ts +0 -34
  35. package/src/core/ActorRegistry.ts +0 -26
  36. package/src/core/ActorRunner.ts +0 -240
  37. package/src/core/defineActor.ts +0 -5
  38. package/src/core/index.ts +0 -5
  39. package/src/errors/AuthError.ts +0 -7
  40. package/src/errors/AutomationError.ts +0 -26
  41. package/src/errors/ConfigError.ts +0 -7
  42. package/src/errors/ExtractionError.ts +0 -7
  43. package/src/errors/NavigationError.ts +0 -7
  44. package/src/errors/SelectorError.ts +0 -10
  45. package/src/errors/index.ts +0 -6
  46. package/src/extraction/Extractor.ts +0 -65
  47. package/src/extraction/Pagination.ts +0 -47
  48. package/src/extraction/index.ts +0 -2
  49. package/src/index.ts +0 -9
  50. package/src/interaction/FieldClearer.ts +0 -73
  51. package/src/interaction/Forms.ts +0 -27
  52. package/src/interaction/GhostCursorAdapter.ts +0 -79
  53. package/src/interaction/HumanInteractor.ts +0 -32
  54. package/src/interaction/HumanTyping.ts +0 -157
  55. package/src/interaction/NativePuppeteerInteractor.ts +0 -68
  56. package/src/interaction/Navigation.ts +0 -37
  57. package/src/interaction/PageAdapter.ts +0 -86
  58. package/src/interaction/Waits.ts +0 -5
  59. package/src/interaction/index.ts +0 -9
  60. package/src/logging/ConsoleLogger.ts +0 -44
  61. package/src/logging/Logger.ts +0 -15
  62. package/src/logging/MemoryLogger.ts +0 -34
  63. package/src/logging/NullLogger.ts +0 -8
  64. package/src/logging/index.ts +0 -4
  65. package/src/sites/example/example.actor.ts +0 -53
  66. package/src/sites/example/example.selectors.ts +0 -17
  67. package/src/sites/example/example.types.ts +0 -18
  68. package/src/sites/example/index.ts +0 -3
  69. package/src/sites/index.ts +0 -3
  70. package/src/sites/myvistage-com/index.ts +0 -3
  71. package/src/sites/myvistage-com/login-action-list.json +0 -349
  72. package/src/sites/myvistage-com/myvistage-com.actor.ts +0 -50
  73. package/src/sites/myvistage-com/myvistage-com.selectors.ts +0 -14
  74. package/src/sites/myvistage-com/myvistage-com.types.ts +0 -18
  75. package/src/sites/myvistage-com/post-comment-action.json +0 -81
  76. package/src/sites/upwork-com/index.ts +0 -6
  77. package/src/sites/upwork-com/upwork-com.actor.ts +0 -97
  78. package/src/sites/upwork-com/upwork-com.runner.ts +0 -17
  79. package/src/sites/upwork-com/upwork-com.selectors.ts +0 -10
  80. package/src/sites/upwork-com/upwork-com.types.ts +0 -102
  81. package/src/sites/upwork-com/upwork-com.util.ts +0 -41
  82. package/src/utils/delay.ts +0 -4
  83. package/src/utils/index.ts +0 -5
  84. package/src/utils/invariant.ts +0 -7
  85. package/src/utils/redact.ts +0 -53
  86. package/src/utils/retry.ts +0 -31
  87. package/src/utils/url.ts +0 -7
  88. package/tests/fixtures/FakeCredentialsProvider.ts +0 -12
  89. package/tests/fixtures/FakeCursor.ts +0 -48
  90. package/tests/fixtures/FakePage.ts +0 -266
  91. package/tests/fixtures/makeContext.ts +0 -76
  92. package/tests/unit/auth/AuthStateDetector.test.ts +0 -80
  93. package/tests/unit/auth/LoginFlow.test.ts +0 -296
  94. package/tests/unit/browser/BrowserFactory.test.ts +0 -370
  95. package/tests/unit/core/ActorRunner.test.ts +0 -370
  96. package/tests/unit/core/defineActor.test.ts +0 -112
  97. package/tests/unit/extraction/Extractor.test.ts +0 -48
  98. package/tests/unit/extraction/Pagination.test.ts +0 -54
  99. package/tests/unit/interaction/FieldClearer.test.ts +0 -29
  100. package/tests/unit/interaction/Forms.test.ts +0 -35
  101. package/tests/unit/interaction/GhostCursorAdapter.test.ts +0 -68
  102. package/tests/unit/interaction/HumanTyping.test.ts +0 -54
  103. package/tests/unit/interaction/NativePuppeteerInteractor.test.ts +0 -22
  104. package/tests/unit/interaction/PageAdapter.test.ts +0 -25
  105. package/tests/unit/logging/redact.test.ts +0 -36
  106. package/tests/unit/sites/myvistage-com.actor.test.ts +0 -19
  107. package/tests/unit/sites/myvistage-com.login.test.ts +0 -22
  108. package/tests/unit/sites/myvistage-com.postComment.test.ts +0 -70
  109. package/tests/unit/sites/upwork-com.login.test.ts +0 -52
  110. package/tsconfig.build.json +0 -9
  111. package/tsconfig.json +0 -22
  112. package/vitest.config.ts +0 -12
@@ -1,96 +0,0 @@
1
- export default {
2
- id: 'cli-command',
3
- description: 'Modify CLI behavior, environment variable parsing, command inputs, actor registration, and CLI documentation.',
4
- instructions: `
5
- Modify the CLI entrypoint in src/cli/run.ts.
6
-
7
- Rules:
8
- - Keep CLI config construction aligned with RuntimeConfig types.
9
- - Preserve JSON input parsing behavior unless explicitly changing it.
10
- - Keep environment variable names documented in README.
11
- - Validate ambiguous or conflicting env vars and fail with clear ConfigError messages.
12
- - When adding actor registration behavior, update ActorRegistry usage and site exports if needed.
13
- - If CLI can affect browser lifecycle, verify close/disconnect behavior matches BrowserSession and RuntimeConfig defaults.
14
- - Add tests if the change can be unit-tested without spawning Chrome.
15
-
16
- DO NOT hard-code machine-specific Chrome paths, credentials, or profile directories.
17
- DO NOT default remote debugging to a non-localhost address.
18
- `.trim(),
19
- output: {
20
- pathTemplates: [
21
- {
22
- key: 'cli',
23
- pathTemplate: 'src/cli/run.ts',
24
- description: 'CLI entrypoint and env/input parsing.'
25
- },
26
- {
27
- key: 'runtime-config',
28
- pathTemplate: 'src/browser/RuntimeConfig.ts',
29
- description: 'Runtime config types if CLI config surface changes.'
30
- },
31
- {
32
- key: 'actor-registry',
33
- pathTemplate: 'src/core/ActorRegistry.ts',
34
- description: 'Registry behavior if actor lookup changes.'
35
- },
36
- {
37
- key: 'docs',
38
- pathTemplate: 'README.md',
39
- description: 'CLI usage and env var documentation.'
40
- },
41
- {
42
- key: 'tests',
43
- pathTemplate: 'tests/unit/cli/{{featureKebab}}.test.ts',
44
- description: 'CLI unit tests for parser/config helpers when added.'
45
- }
46
- ],
47
- maxFiles: 5
48
- },
49
- parameters: {
50
- feature: {
51
- description: 'CLI feature to implement, for example env var, input parsing, registry loading, or run mode.',
52
- required: true
53
- },
54
- instructions: {
55
- description: 'Detailed CLI behavior, examples, env vars, and failure cases.',
56
- required: false
57
- }
58
- },
59
- examples: [
60
- 'src/cli/run.ts',
61
- 'src/browser/RuntimeConfig.ts',
62
- 'src/core/ActorRegistry.ts',
63
- 'README.md'
64
- ],
65
- context: [
66
- { kind: 'path', path: 'src/cli/run.ts', description: 'Current CLI implementation.' },
67
- { kind: 'path', path: 'src/browser/RuntimeConfig.ts', description: 'Runtime config consumed by CLI.' },
68
- { kind: 'path', path: 'src/core/ActorRegistry.ts', description: 'Actor registration and lookup.' },
69
- { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Runner invoked by CLI.' },
70
- { kind: 'path', path: 'src/sites/example/example.actor.ts', description: 'Example actor currently registered by CLI.' },
71
- { kind: 'path', path: 'src/sites/index.ts', description: 'Site exports available to CLI.' },
72
- { kind: 'path', path: 'src/errors/ConfigError.ts', description: 'Config error class for CLI validation failures.' },
73
- { kind: 'path', path: 'README.md', description: 'Documentation that should match CLI behavior.' }
74
- ],
75
- keywordContexts: [
76
- {
77
- keywords: ['browser', 'chrome', 'profile', 'remote debugging', 'debug endpoint'],
78
- context: [
79
- { kind: 'path', path: 'src/browser/BrowserFactory.ts', description: 'Browser launch/connect behavior that CLI config drives.' },
80
- { kind: 'path', path: 'tests/unit/browser/BrowserFactory.test.ts', description: 'Runtime config behavior tests.' }
81
- ]
82
- },
83
- {
84
- keywords: ['site', 'actor', 'registry'],
85
- context: [
86
- { kind: 'path', path: 'src/core/Actor.ts', description: 'Actor contracts.' },
87
- { kind: 'pattern', pattern: 'src/sites/**/*.actor.ts', description: 'Existing site actor modules.', limit: 5 }
88
- ]
89
- }
90
- ],
91
- tooling: {
92
- allowGetExistingCode: true,
93
- allowFindFiles: true,
94
- allowSearchRepo: true
95
- }
96
- };
@@ -1,80 +0,0 @@
1
- export default {
2
- id: 'core-framework',
3
- description:
4
- 'Modify core actor framework behavior: ActorRunner, ActorContext, ActorRegistry, defineActor, hooks, context services, and execution lifecycle.',
5
- instructions: `
6
- Make reusable framework changes in src/core unless another layer clearly owns the behavior.
7
-
8
- Rules:
9
- - ActorRunner coordinates browser session creation, auth, task execution, hooks, error wrapping, and cleanup.
10
- - ActorContext should expose stable services to site actors; avoid leaking low-level implementation details unless necessary.
11
- - Keep defineActor simple and type-preserving.
12
- - Keep ActorRegistry focused on registration and lookup.
13
- - Do not implement site-specific scraping in core.
14
- - Add unit tests for every lifecycle, auth, context, or hook behavior change.
15
- `.trim(),
16
- output: {
17
- pathTemplates: [
18
- { key: 'actor', pathTemplate: 'src/core/Actor.ts', description: 'Actor/task/hook types.' },
19
- { key: 'context', pathTemplate: 'src/core/ActorContext.ts', description: 'Task context services.' },
20
- { key: 'runner', pathTemplate: 'src/core/ActorRunner.ts', description: 'Execution lifecycle implementation.' },
21
- { key: 'registry', pathTemplate: 'src/core/ActorRegistry.ts', description: 'Actor registry implementation.' },
22
- { key: 'define-actor', pathTemplate: 'src/core/defineActor.ts', description: 'Actor definition helper.' },
23
- { key: 'core-index', pathTemplate: 'src/core/index.ts', description: 'Core barrel exports.' },
24
- { key: 'runner-tests', pathTemplate: 'tests/unit/core/ActorRunner.test.ts', description: 'Runner lifecycle tests.' },
25
- { key: 'define-tests', pathTemplate: 'tests/unit/core/defineActor.test.ts', description: 'defineActor type/runtime tests.' }
26
- ],
27
- maxFiles: 8
28
- },
29
- parameters: {
30
- feature: {
31
- description: 'Core framework feature to add or change, for example hooks, context service, actor lookup, or error wrapping.',
32
- required: true
33
- },
34
- instructions: {
35
- description: 'Detailed behavior, affected actors, lifecycle semantics, and test expectations.',
36
- required: false
37
- }
38
- },
39
- examples: [
40
- 'src/core/ActorRunner.ts',
41
- 'src/core/ActorContext.ts',
42
- 'src/core/ActorRegistry.ts',
43
- 'tests/unit/core/ActorRunner.test.ts'
44
- ],
45
- context: [
46
- { kind: 'path', path: 'src/core/Actor.ts', description: 'Actor/task/hook types.' },
47
- { kind: 'path', path: 'src/core/ActorContext.ts', description: 'Services exposed to tasks.' },
48
- { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Execution lifecycle.' },
49
- { kind: 'path', path: 'src/core/ActorRegistry.ts', description: 'Registry behavior.' },
50
- { kind: 'path', path: 'src/core/defineActor.ts', description: 'Type-preserving actor helper.' },
51
- { kind: 'path', path: 'src/browser/BrowserSession.ts', description: 'Session lifecycle consumed by ActorRunner.' },
52
- { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Auth service used by ActorRunner.' },
53
- { kind: 'path', path: 'src/errors/AutomationError.ts', description: 'Base error wrapper used by ActorRunner.' },
54
- { kind: 'pattern', pattern: 'tests/unit/core/*.test.ts', description: 'Core unit tests.', limit: 5 },
55
- { kind: 'path', path: 'tests/fixtures/makeContext.ts', description: 'ActorContext test fixture.' }
56
- ],
57
- keywordContexts: [
58
- {
59
- keywords: ['browser', 'session', 'cleanup', 'close', 'disconnect'],
60
- context: [
61
- { kind: 'path', path: 'src/browser/BrowserFactory.ts', description: 'BrowserSession creation behavior.' },
62
- { kind: 'path', path: 'src/browser/BrowserSession.ts', description: 'Close/disconnect behavior.' },
63
- { kind: 'path', path: 'tests/unit/browser/BrowserFactory.test.ts', description: 'Browser lifecycle tests.' }
64
- ]
65
- },
66
- {
67
- keywords: ['auth', 'login', 'ensureAuthenticated', 'isLoggedIn'],
68
- context: [
69
- { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Auth execution consumed by ActorRunner.' },
70
- { kind: 'path', path: 'src/auth/AuthStateDetector.ts', description: 'Logged-in detection consumed by context auth controller.' },
71
- { kind: 'path', path: 'tests/unit/auth/LoginFlow.test.ts', description: 'Auth behavior tests.' }
72
- ]
73
- }
74
- ],
75
- tooling: {
76
- allowGetExistingCode: true,
77
- allowFindFiles: true,
78
- allowSearchRepo: true
79
- }
80
- };
@@ -1,92 +0,0 @@
1
- export default {
2
- id: 'docs',
3
- description: 'Update README and usage documentation for framework features, site actors, CLI examples, browser setup, and auth/login examples.',
4
- instructions: `
5
- Update documentation to match the actual code.
6
-
7
- Rules:
8
- - Keep examples consistent with RuntimeConfig, ActorRunner, LoginFlowDefinition, and CLI behavior.
9
- - Use the example actor only as a pattern; do not imply it scrapes a real site unless it does.
10
- - Include concrete command examples when documenting CLI behavior.
11
- - Include safe Chrome remote debugging examples bound to 127.0.0.1 when documenting running Chrome attach.
12
- - Document environment variables only if src/cli/run.ts supports them.
13
- - Avoid overstating test coverage or behavior not implemented in code.
14
- - Keep docs practical and concise.
15
-
16
- DO NOT include real credentials, cookies, tokens, or private local paths.
17
- DO NOT document CAPTCHA bypass or anti-bot circumvention.
18
- `.trim(),
19
- output: {
20
- pathTemplates: [
21
- {
22
- key: 'readme',
23
- pathTemplate: 'README.md',
24
- description: 'Primary project documentation.'
25
- },
26
- {
27
- key: 'example-actor',
28
- pathTemplate: 'src/sites/example/example.actor.ts',
29
- description: 'Update only if documentation examples require the example actor to change.'
30
- },
31
- {
32
- key: 'cli',
33
- pathTemplate: 'src/cli/run.ts',
34
- description: 'Update only if docs expose CLI behavior that code does not yet support.'
35
- }
36
- ],
37
- maxFiles: 3
38
- },
39
- parameters: {
40
- topic: {
41
- description: 'Documentation topic, for example multi-step login, running Chrome attach, human typing, creating site actors, or CLI usage.',
42
- required: true
43
- },
44
- instructions: {
45
- description: 'Specific docs to add, change, or clarify.',
46
- required: false
47
- }
48
- },
49
- examples: [
50
- 'README.md',
51
- 'src/sites/example/example.actor.ts',
52
- 'src/cli/run.ts'
53
- ],
54
- context: [
55
- { kind: 'path', path: 'README.md', description: 'Existing documentation.' },
56
- { kind: 'path', path: 'package.json', description: 'Scripts, package name, binary name, and dependencies.' },
57
- { kind: 'path', path: 'src/browser/RuntimeConfig.ts', description: 'Runtime config docs must match these types.' },
58
- { kind: 'path', path: 'src/browser/BrowserFactory.ts', description: 'Launch/connect behavior docs must match this implementation.' },
59
- { kind: 'path', path: 'src/auth/LoginFlow.types.ts', description: 'Login examples must match these types.' },
60
- { kind: 'path', path: 'src/interaction/HumanTyping.ts', description: 'Typing docs must match these options/defaults.' },
61
- { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Runner examples must match constructor/run behavior.' },
62
- { kind: 'path', path: 'src/cli/run.ts', description: 'CLI examples must match env parsing and command behavior.' },
63
- { kind: 'path', path: 'src/sites/example/example.actor.ts', description: 'Example actor implementation.' }
64
- ],
65
- keywordContexts: [
66
- {
67
- keywords: ['login', 'multi-step', 'auth', 'credentials'],
68
- context: [
69
- { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Login execution details.' },
70
- { kind: 'path', path: 'tests/unit/auth/LoginFlow.test.ts', description: 'Behavior examples from tests.' }
71
- ]
72
- },
73
- {
74
- keywords: ['browser', 'chrome', 'debug endpoint', 'remote debugging', 'profile'],
75
- context: [
76
- { kind: 'path', path: 'tests/unit/browser/BrowserFactory.test.ts', description: 'Browser behavior examples from tests.' }
77
- ]
78
- },
79
- {
80
- keywords: ['site', 'actor', 'task', 'scrape'],
81
- context: [
82
- { kind: 'path', path: 'src/core/Actor.ts', description: 'Actor/task contracts.' },
83
- { kind: 'path', path: 'src/extraction/Extractor.ts', description: 'Extraction helpers available to actor tasks.' }
84
- ]
85
- }
86
- ],
87
- tooling: {
88
- allowGetExistingCode: true,
89
- allowFindFiles: true,
90
- allowSearchRepo: true
91
- }
92
- };
@@ -1,102 +0,0 @@
1
- export default {
2
- id: 'error-logging',
3
- description: 'Modify typed errors, logging implementations, metadata redaction, and diagnostics behavior.',
4
- instructions: `
5
- Update error/logging behavior safely.
6
-
7
- Rules:
8
- - Keep AutomationError as the base class for framework-level errors.
9
- - Preserve useful metadata: actorId, taskName, url, selector, and cause where applicable.
10
- - Keep logging implementation independent from site-specific code.
11
- - Redact sensitive metadata recursively before writing logs.
12
- - Add tests for every new redaction key or error metadata behavior.
13
- - If a browser/auth/core module starts throwing a new typed error, update the relevant unit tests there too.
14
- - Prefer typed errors over plain Error for framework-level failures.
15
-
16
- DO NOT log raw passwords, tokens, authorization headers, cookies, or session secrets.
17
- DO NOT swallow causes; preserve them in metadata where feasible.
18
- `.trim(),
19
- output: {
20
- pathTemplates: [
21
- {
22
- key: 'error',
23
- pathTemplate: 'src/errors/{{errorPascal}}.ts',
24
- description: 'Typed error class. Use existing files when editing existing errors.'
25
- },
26
- {
27
- key: 'errors-index',
28
- pathTemplate: 'src/errors/index.ts',
29
- description: 'Error barrel exports.'
30
- },
31
- {
32
- key: 'logger',
33
- pathTemplate: 'src/logging/{{loggerPascal}}.ts',
34
- description: 'Logger interface or implementation. Use existing files when editing existing loggers.'
35
- },
36
- {
37
- key: 'redact',
38
- pathTemplate: 'src/utils/redact.ts',
39
- description: 'Sensitive metadata redaction utility.'
40
- },
41
- {
42
- key: 'tests',
43
- pathTemplate: 'tests/unit/logging/{{subjectPascal}}.test.ts',
44
- description: 'Logging/redaction unit tests.'
45
- }
46
- ],
47
- maxFiles: 5
48
- },
49
- parameters: {
50
- subject: {
51
- description: 'Error/logging/redaction behavior to implement or update.',
52
- required: true
53
- },
54
- instructions: {
55
- description: 'Specific metadata, redaction keys, logger behavior, or error semantics.',
56
- required: false
57
- }
58
- },
59
- examples: [
60
- 'src/errors/AutomationError.ts',
61
- 'src/errors/AuthError.ts',
62
- 'src/logging/ConsoleLogger.ts',
63
- 'src/logging/MemoryLogger.ts',
64
- 'src/utils/redact.ts',
65
- 'tests/unit/logging/redact.test.ts'
66
- ],
67
- context: [
68
- { kind: 'pattern', pattern: 'src/errors/*.ts', description: 'Existing typed errors and barrel export.', limit: 10 },
69
- { kind: 'pattern', pattern: 'src/logging/*.ts', description: 'Logger interface and implementations.', limit: 10 },
70
- { kind: 'path', path: 'src/utils/redact.ts', description: 'Sensitive metadata redaction utility.' },
71
- { kind: 'path', path: 'tests/unit/logging/redact.test.ts', description: 'Existing redaction tests.' },
72
- { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Auth error and redacted logging usage.' },
73
- { kind: 'path', path: 'src/browser/BrowserFactory.ts', description: 'ConfigError metadata usage.' },
74
- { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Error wrapping behavior.' }
75
- ],
76
- keywordContexts: [
77
- {
78
- keywords: ['auth', 'login', 'credentials', 'password'],
79
- context: [
80
- { kind: 'path', path: 'tests/unit/auth/LoginFlow.test.ts', description: 'Auth tests may need error/log assertion updates.' }
81
- ]
82
- },
83
- {
84
- keywords: ['browser', 'chrome', 'profile', 'remote debugging'],
85
- context: [
86
- { kind: 'path', path: 'tests/unit/browser/BrowserFactory.test.ts', description: 'Browser error tests.' }
87
- ]
88
- },
89
- {
90
- keywords: ['selector', 'form', 'extraction'],
91
- context: [
92
- { kind: 'path', path: 'tests/unit/interaction/Forms.test.ts', description: 'Selector error behavior tests.' },
93
- { kind: 'path', path: 'tests/unit/extraction/Extractor.test.ts', description: 'Extraction behavior tests.' }
94
- ]
95
- }
96
- ],
97
- tooling: {
98
- allowGetExistingCode: true,
99
- allowFindFiles: true,
100
- allowSearchRepo: true
101
- }
102
- };
@@ -1,96 +0,0 @@
1
- export default {
2
- id: 'extraction-helper',
3
- description: 'Add or modify reusable extraction helpers, pagination behavior, data mapping utilities, and extraction tests.',
4
- instructions: `
5
- Add or revise extraction utilities for reusable scraping behavior.
6
-
7
- Rules:
8
- - Keep extraction helpers generic and site-agnostic.
9
- - Use PageAdapter methods before reaching for raw Puppeteer APIs.
10
- - Preserve existing Extractor and Pagination behavior unless the user asks for a change.
11
- - Return normalized values where possible: trimmed text, null for missing optional attributes, arrays for lists.
12
- - Make missing-required-element behavior explicit in options rather than surprising callers.
13
- - Add unit tests using FakePage for every new extraction behavior.
14
- - Update src/extraction/index.ts when adding a new exported helper.
15
- - Update src/index.ts if the new helper is part of the public package API.
16
-
17
- DO NOT put site-specific selectors or actor-specific data shapes in generic extraction helpers.
18
- `.trim(),
19
- output: {
20
- pathTemplates: [
21
- {
22
- key: 'helper',
23
- pathTemplate: 'src/extraction/{{helperPascal}}.ts',
24
- description: 'New extraction helper. Use Extractor.ts or Pagination.ts directly when editing existing helpers.'
25
- },
26
- {
27
- key: 'extraction-index',
28
- pathTemplate: 'src/extraction/index.ts',
29
- description: 'Extraction barrel export.'
30
- },
31
- {
32
- key: 'root-index',
33
- pathTemplate: 'src/index.ts',
34
- description: 'Root package export when public API changes.'
35
- },
36
- {
37
- key: 'tests',
38
- pathTemplate: 'tests/unit/extraction/{{helperPascal}}.test.ts',
39
- description: 'Unit tests for the extraction helper.'
40
- },
41
- {
42
- key: 'fake-page',
43
- pathTemplate: 'tests/fixtures/FakePage.ts',
44
- description: 'Update when the helper requires new fake page behavior.'
45
- }
46
- ],
47
- maxFiles: 5
48
- },
49
- parameters: {
50
- helper: {
51
- description: 'Extraction helper to add or modify, for example TableExtractor, Pagination, JsonLdExtractor, or Extractor.',
52
- required: true
53
- },
54
- instructions: {
55
- description: 'Specific selectors, data shape, normalization, pagination, or edge cases.',
56
- required: false
57
- }
58
- },
59
- examples: [
60
- 'src/extraction/Extractor.ts',
61
- 'src/extraction/Pagination.ts',
62
- 'tests/unit/extraction/Extractor.test.ts',
63
- 'tests/unit/extraction/Pagination.test.ts'
64
- ],
65
- context: [
66
- { kind: 'path', path: 'src/extraction/Extractor.ts', description: 'Current extraction helper.' },
67
- { kind: 'path', path: 'src/extraction/Pagination.ts', description: 'Current pagination helper.' },
68
- { kind: 'path', path: 'src/extraction/index.ts', description: 'Extraction barrel export.' },
69
- { kind: 'path', path: 'src/interaction/PageAdapter.ts', description: 'Page operations available to extraction helpers.' },
70
- { kind: 'path', path: 'src/errors/ExtractionError.ts', description: 'Typed extraction error.' },
71
- { kind: 'path', path: 'tests/unit/extraction/Extractor.test.ts', description: 'Extractor tests.' },
72
- { kind: 'path', path: 'tests/unit/extraction/Pagination.test.ts', description: 'Pagination tests.' },
73
- { kind: 'path', path: 'tests/fixtures/FakePage.ts', description: 'Fake page fixture.' },
74
- { kind: 'path', path: 'tests/fixtures/FakeCursor.ts', description: 'Fake cursor for pagination click tests.' }
75
- ],
76
- keywordContexts: [
77
- {
78
- keywords: ['actor', 'site', 'task', 'scraper'],
79
- context: [
80
- { kind: 'path', path: 'src/core/ActorContext.ts', description: 'Extraction helpers available in ActorContext.' },
81
- { kind: 'path', path: 'src/sites/example/example.actor.ts', description: 'Example actor usage of extraction.' }
82
- ]
83
- },
84
- {
85
- keywords: ['selector', 'wait', 'page adapter', 'raw puppeteer'],
86
- context: [
87
- { kind: 'path', path: 'tests/unit/interaction/PageAdapter.test.ts', description: 'PageAdapter behavior tests.' }
88
- ]
89
- }
90
- ],
91
- tooling: {
92
- allowGetExistingCode: true,
93
- allowFindFiles: true,
94
- allowSearchRepo: true
95
- }
96
- };
@@ -1,129 +0,0 @@
1
- export default {
2
- id: 'interaction-behavior',
3
- description: 'Modify human interaction behavior: ghost-cursor adapter, native interactor, typing, field clearing, forms, navigation, waits, and page adapter behavior.',
4
- instructions: `
5
- Modify the interaction layer while preserving the HumanInteractor abstraction.
6
-
7
- Rules:
8
- - Keep HumanInteractor as the contract that site actors and forms use.
9
- - Keep ghost-cursor-specific details inside GhostCursorAdapter.
10
- - Keep NativePuppeteerInteractor deterministic and suitable for tests/fallbacks.
11
- - Human-like typing should remain key-by-key unless explicitly disabled.
12
- - Field clearing should remain opt-in through options and login defaults, not forced globally for all interactions.
13
- - If PageAdapter gains a method, update PuppeteerPageAdapter and FakePage where appropriate.
14
- - If FormFiller behavior changes, update Forms tests and any affected LoginFlow tests.
15
- - If typing timing changes, update HumanTyping tests with deterministic random/sleep functions.
16
-
17
- DO NOT put site-specific selectors or auth flow logic in the interaction layer.
18
- DO NOT introduce sleeps where selector waits or navigation waits are more precise.
19
- `.trim(),
20
- output: {
21
- pathTemplates: [
22
- {
23
- key: 'human-interactor',
24
- pathTemplate: 'src/interaction/HumanInteractor.ts',
25
- description: 'Human interaction interface and shared options.'
26
- },
27
- {
28
- key: 'ghost-adapter',
29
- pathTemplate: 'src/interaction/GhostCursorAdapter.ts',
30
- description: 'ghost-cursor-backed interactor implementation.'
31
- },
32
- {
33
- key: 'native-adapter',
34
- pathTemplate: 'src/interaction/NativePuppeteerInteractor.ts',
35
- description: 'Puppeteer-native interactor implementation.'
36
- },
37
- {
38
- key: 'typing',
39
- pathTemplate: 'src/interaction/HumanTyping.ts',
40
- description: 'Typing timing and key-by-key typing implementation.'
41
- },
42
- {
43
- key: 'field-clearer',
44
- pathTemplate: 'src/interaction/FieldClearer.ts',
45
- description: 'Field clearing strategies.'
46
- },
47
- {
48
- key: 'forms',
49
- pathTemplate: 'src/interaction/Forms.ts',
50
- description: 'Form filling helper.'
51
- },
52
- {
53
- key: 'page-adapter',
54
- pathTemplate: 'src/interaction/PageAdapter.ts',
55
- description: 'Page adapter when new selector/page operations are needed.'
56
- },
57
- {
58
- key: 'tests',
59
- pathTemplate: 'tests/unit/interaction/{{componentPascal}}.test.ts',
60
- description: 'Focused tests for the changed interaction component.'
61
- },
62
- {
63
- key: 'fake-page',
64
- pathTemplate: 'tests/fixtures/FakePage.ts',
65
- description: 'Update when PageAdapter or keyboard/page behavior changes.'
66
- },
67
- {
68
- key: 'fake-cursor',
69
- pathTemplate: 'tests/fixtures/FakeCursor.ts',
70
- description: 'Update when cursor behavior or recorded calls change.'
71
- }
72
- ],
73
- maxFiles: 10
74
- },
75
- parameters: {
76
- component: {
77
- description: 'Interaction component or behavior to edit, for example typing, cursor, forms, field clearing, page adapter, or navigation.',
78
- required: true
79
- },
80
- instructions: {
81
- description: 'Specific behavior, options, timing, selectors, or compatibility requirements.',
82
- required: false
83
- }
84
- },
85
- examples: [
86
- 'src/interaction/HumanInteractor.ts',
87
- 'src/interaction/GhostCursorAdapter.ts',
88
- 'src/interaction/HumanTyping.ts',
89
- 'src/interaction/FieldClearer.ts',
90
- 'tests/unit/interaction/HumanTyping.test.ts',
91
- 'tests/fixtures/FakePage.ts'
92
- ],
93
- context: [
94
- { kind: 'path', path: 'src/interaction/HumanInteractor.ts', description: 'Interaction contract.' },
95
- { kind: 'path', path: 'src/interaction/GhostCursorAdapter.ts', description: 'ghost-cursor interactor.' },
96
- { kind: 'path', path: 'src/interaction/NativePuppeteerInteractor.ts', description: 'Puppeteer-native interactor.' },
97
- { kind: 'path', path: 'src/interaction/HumanTyping.ts', description: 'Human typing implementation.' },
98
- { kind: 'path', path: 'src/interaction/FieldClearer.ts', description: 'Field clearing implementation.' },
99
- { kind: 'path', path: 'src/interaction/Forms.ts', description: 'Form helper.' },
100
- { kind: 'path', path: 'src/interaction/PageAdapter.ts', description: 'Page wrapper.' },
101
- { kind: 'path', path: 'src/interaction/Navigation.ts', description: 'Navigation helper.' },
102
- { kind: 'path', path: 'src/interaction/Waits.ts', description: 'Wait profiles.' },
103
- { kind: 'path', path: 'src/browser/PuppeteerLike.ts', description: 'Keyboard/page/browser types used by interactors and tests.' },
104
- { kind: 'pattern', pattern: 'tests/unit/interaction/*.test.ts', description: 'Existing interaction tests.', limit: 10 },
105
- { kind: 'path', path: 'tests/fixtures/FakePage.ts', description: 'Fake page fixture.' },
106
- { kind: 'path', path: 'tests/fixtures/FakeCursor.ts', description: 'Fake cursor fixture.' }
107
- ],
108
- keywordContexts: [
109
- {
110
- keywords: ['login', 'auth', 'clearFieldBeforeTyping'],
111
- context: [
112
- { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Login fill steps consume form/interactor options.' },
113
- { kind: 'path', path: 'tests/unit/auth/LoginFlow.test.ts', description: 'Login tests may need updates after interaction changes.' }
114
- ]
115
- },
116
- {
117
- keywords: ['runtime config', 'default typing', 'config'],
118
- context: [
119
- { kind: 'path', path: 'src/browser/RuntimeConfig.ts', description: 'Global interaction typing config.' },
120
- { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Passes typing config to GhostCursorAdapter.' }
121
- ]
122
- }
123
- ],
124
- tooling: {
125
- allowGetExistingCode: true,
126
- allowFindFiles: true,
127
- allowSearchRepo: true
128
- }
129
- };