@epsilon-asi/actors 0.0.3 → 0.0.5

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/.ai/generators/_template.ts +37 -0
  2. package/.ai/generators/abstract.ts +24 -0
  3. package/.ai/generators/actor-task-form-filler.ts +140 -0
  4. package/.ai/generators/actor-task.ts +122 -0
  5. package/.ai/generators/auth-core.ts +126 -0
  6. package/.ai/generators/browser-runtime.ts +114 -0
  7. package/.ai/generators/cli-command.ts +96 -0
  8. package/.ai/generators/core-framework.ts +80 -0
  9. package/.ai/generators/docs.ts +92 -0
  10. package/.ai/generators/error-logging.ts +102 -0
  11. package/.ai/generators/extraction-helper.ts +96 -0
  12. package/.ai/generators/interaction-behavior.ts +129 -0
  13. package/.ai/generators/site-actor.ts +125 -0
  14. package/.ai/generators/site-login-flow.ts +117 -0
  15. package/.ai/generators/unit-test.ts +109 -0
  16. package/.ai/workflows/_template.ts +20 -0
  17. package/.ai/workflows/starter.ts +20 -0
  18. package/ai-gen.config.ts +67 -0
  19. package/package.json +4 -12
  20. package/src/auth/AuthStateDetector.ts +18 -0
  21. package/src/auth/CredentialsProvider.ts +48 -0
  22. package/src/auth/LoginFlow.ts +332 -0
  23. package/src/auth/LoginFlow.types.ts +141 -0
  24. package/src/auth/SessionStore.ts +21 -0
  25. package/src/auth/index.ts +5 -0
  26. package/src/browser/BrowserFactory.ts +253 -0
  27. package/src/browser/BrowserSession.ts +50 -0
  28. package/src/browser/PuppeteerLike.ts +65 -0
  29. package/src/browser/RuntimeConfig.ts +152 -0
  30. package/src/browser/index.ts +5 -0
  31. package/src/browser/profileValidation.ts +73 -0
  32. package/src/cli/run.ts +112 -0
  33. package/src/core/Actor.ts +167 -0
  34. package/src/core/ActorContext.ts +34 -0
  35. package/src/core/ActorRegistry.ts +26 -0
  36. package/src/core/ActorRunner.ts +240 -0
  37. package/src/core/defineActor.ts +5 -0
  38. package/src/core/index.ts +5 -0
  39. package/src/errors/AuthError.ts +7 -0
  40. package/src/errors/AutomationError.ts +26 -0
  41. package/src/errors/ConfigError.ts +7 -0
  42. package/src/errors/ExtractionError.ts +7 -0
  43. package/src/errors/NavigationError.ts +7 -0
  44. package/src/errors/SelectorError.ts +10 -0
  45. package/src/errors/index.ts +6 -0
  46. package/src/extraction/Extractor.ts +65 -0
  47. package/src/extraction/Pagination.ts +47 -0
  48. package/src/extraction/index.ts +2 -0
  49. package/src/index.ts +9 -0
  50. package/src/interaction/FieldClearer.ts +73 -0
  51. package/src/interaction/Forms.ts +27 -0
  52. package/src/interaction/GhostCursorAdapter.ts +79 -0
  53. package/src/interaction/HumanInteractor.ts +32 -0
  54. package/src/interaction/HumanTyping.ts +157 -0
  55. package/src/interaction/NativePuppeteerInteractor.ts +68 -0
  56. package/src/interaction/Navigation.ts +37 -0
  57. package/src/interaction/PageAdapter.ts +86 -0
  58. package/src/interaction/Waits.ts +5 -0
  59. package/src/interaction/index.ts +9 -0
  60. package/src/logging/ConsoleLogger.ts +44 -0
  61. package/src/logging/Logger.ts +15 -0
  62. package/src/logging/MemoryLogger.ts +34 -0
  63. package/src/logging/NullLogger.ts +8 -0
  64. package/src/logging/index.ts +4 -0
  65. package/src/sites/example/example.actor.ts +53 -0
  66. package/src/sites/example/example.selectors.ts +17 -0
  67. package/src/sites/example/example.types.ts +18 -0
  68. package/src/sites/example/index.ts +3 -0
  69. package/src/sites/index.ts +3 -0
  70. package/src/sites/myvistage-com/index.ts +3 -0
  71. package/src/sites/myvistage-com/login-action-list.json +349 -0
  72. package/src/sites/myvistage-com/myvistage-com.actor.ts +50 -0
  73. package/src/sites/myvistage-com/myvistage-com.selectors.ts +14 -0
  74. package/src/sites/myvistage-com/myvistage-com.types.ts +18 -0
  75. package/src/sites/myvistage-com/post-comment-action.json +81 -0
  76. package/src/sites/upwork-com/index.ts +6 -0
  77. package/src/sites/upwork-com/upwork-com.actor.ts +97 -0
  78. package/src/sites/upwork-com/upwork-com.runner.ts +17 -0
  79. package/src/sites/upwork-com/upwork-com.selectors.ts +10 -0
  80. package/src/sites/upwork-com/upwork-com.types.ts +102 -0
  81. package/src/sites/upwork-com/upwork-com.util.ts +41 -0
  82. package/src/utils/delay.ts +4 -0
  83. package/src/utils/index.ts +5 -0
  84. package/src/utils/invariant.ts +7 -0
  85. package/src/utils/redact.ts +53 -0
  86. package/src/utils/retry.ts +31 -0
  87. package/src/utils/url.ts +7 -0
  88. package/tests/fixtures/FakeCredentialsProvider.ts +12 -0
  89. package/tests/fixtures/FakeCursor.ts +48 -0
  90. package/tests/fixtures/FakePage.ts +266 -0
  91. package/tests/fixtures/makeContext.ts +76 -0
  92. package/tests/unit/auth/AuthStateDetector.test.ts +80 -0
  93. package/tests/unit/auth/LoginFlow.test.ts +296 -0
  94. package/tests/unit/browser/BrowserFactory.test.ts +370 -0
  95. package/tests/unit/core/ActorRunner.test.ts +370 -0
  96. package/tests/unit/core/defineActor.test.ts +112 -0
  97. package/tests/unit/extraction/Extractor.test.ts +48 -0
  98. package/tests/unit/extraction/Pagination.test.ts +54 -0
  99. package/tests/unit/interaction/FieldClearer.test.ts +29 -0
  100. package/tests/unit/interaction/Forms.test.ts +35 -0
  101. package/tests/unit/interaction/GhostCursorAdapter.test.ts +68 -0
  102. package/tests/unit/interaction/HumanTyping.test.ts +54 -0
  103. package/tests/unit/interaction/NativePuppeteerInteractor.test.ts +22 -0
  104. package/tests/unit/interaction/PageAdapter.test.ts +25 -0
  105. package/tests/unit/logging/redact.test.ts +36 -0
  106. package/tests/unit/sites/myvistage-com.actor.test.ts +19 -0
  107. package/tests/unit/sites/myvistage-com.login.test.ts +22 -0
  108. package/tests/unit/sites/myvistage-com.postComment.test.ts +70 -0
  109. package/tests/unit/sites/upwork-com.login.test.ts +52 -0
  110. package/tsconfig.build.json +9 -0
  111. package/tsconfig.json +22 -0
  112. package/vitest.config.ts +12 -0
@@ -0,0 +1,37 @@
1
+ export const config = {
2
+ "description": "Describe what this generator should create.",
3
+ "instructions": "Explain the generation rules here.\n- what patterns to copy\n- what not to invent\n- what files to inspect when uncertain",
4
+ "output": {
5
+ "pathTemplate": "src/path/to/{{entityKebab}}.ts",
6
+ "maxFiles": 1
7
+ },
8
+ "parameters": {
9
+ "entity": {
10
+ "description": "Example parameter.",
11
+ "required": true
12
+ }
13
+ },
14
+ "examples": [
15
+ "src/path/to/example-one.ts",
16
+ "src/path/to/example-two.ts"
17
+ ],
18
+ "context": [
19
+ {
20
+ "kind": "path",
21
+ "path": "src/entities/{{entityKebab}}.entity.ts",
22
+ "required": false
23
+ },
24
+ {
25
+ "kind": "pattern",
26
+ "pattern": "*{{entityKebab}}*.service.ts",
27
+ "limit": 3
28
+ }
29
+ ],
30
+ "tooling": {
31
+ "allowGetExistingCode": true,
32
+ "allowFindFiles": true,
33
+ "allowSearchRepo": true
34
+ }
35
+ }
36
+
37
+ export default config;
@@ -0,0 +1,24 @@
1
+ const abstract = {
2
+ "abstract": true,
3
+ "description": "Generate or update files based on the given instructions provided by the user.",
4
+ "instructions": "FIRST you must thoroughly search the codebase for all possible relevant code before proceeding to creating the output that the user as requested.\nIf the user doesn't specify some details, you must infer that based on patterns shown in similar objects or files. For example, if the user asks for an Entity, you must look at other entities and see how they are defined before defining yours. \nGenerate or update files based on the given instructions provided by the user.\nThis file must match structure, imports, decorator usage, route naming, constructor style, DTO references, and service interaction patterns used by other similar files.\nIf you are replacing a file, you must copy it EXACTLY as it is, and then ONLY changing what you are asked to change or add.\n\nRules:\n- You must clearly define property types\n- You must properly type functions \n- Do not map or expose any sensitive properties such as passwords. All other properties are fair game.\n- If you go against patterns shown in other files, you must leave comments explaining why",
5
+ "output": {
6
+ "pathTemplates": [],
7
+ "maxFiles": 5
8
+ },
9
+ "parameters": {
10
+ "instructions": {
11
+ "description": "Guidelines for the agent to know how to define the files or code. i.e its purpose or use",
12
+ "required": true
13
+ }
14
+ },
15
+ "examples": [],
16
+ "context": [],
17
+ "tooling": {
18
+ "allowGetExistingCode": true,
19
+ "allowFindFiles": true,
20
+ "allowSearchRepo": true
21
+ }
22
+ }
23
+
24
+ export default abstract;
@@ -0,0 +1,140 @@
1
+ export default {
2
+ id: 'actor-task-form-filler',
3
+ description: 'Add or update a site actor task that uses defineFormTask/defineFormFillerTask to fill listed fields and submit forms from typed input.',
4
+ instructions: `
5
+ Generate a form-filler actor task using the core task generator helper.
6
+
7
+ Rules:
8
+ - Define the task with defineFormTask or defineFormFillerTask from src/core/Actor.ts.
9
+ - Keep the task inside actor.tasks on an existing site actor.
10
+ - Use typed input/output interfaces in src/sites/{{siteKebab}}/{{siteKebab}}.types.ts.
11
+ - Keep selectors in src/sites/{{siteKebab}}/{{siteKebab}}.selectors.ts.
12
+ - Prefer declarative field mapping via inputKey and use value resolvers only when needed.
13
+ - Mark optional fields with required: false.
14
+ - Use submit.waitForNavigation when submit triggers a page transition.
15
+ - Use onComplete to map final output when the task should return data.
16
+ - Keep actor logic site-specific; do not modify src/core unless the request explicitly requires framework changes.
17
+ - Add focused unit tests that verify field fill order, optional-field behavior, submit click, and completion output.
18
+
19
+ DO NOT call Puppeteer directly for form-filling flows that can be expressed with the form-task definition.
20
+ DO NOT hard-code credentials or secrets.
21
+ `.trim(),
22
+ output: {
23
+ pathTemplates: [
24
+ {
25
+ key: 'actor',
26
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.actor.ts',
27
+ description: 'Site actor task definition using defineFormTask/defineFormFillerTask.'
28
+ },
29
+ {
30
+ key: 'selectors',
31
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.selectors.ts',
32
+ description: 'Form selectors used by the generated task.'
33
+ },
34
+ {
35
+ key: 'types',
36
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.types.ts',
37
+ description: 'Input/output interfaces for the form task.'
38
+ },
39
+ {
40
+ key: 'tests',
41
+ pathTemplate: 'tests/unit/sites/{{siteKebab}}.{{taskName}}.test.ts',
42
+ description: 'Focused form-task behavior tests.'
43
+ }
44
+ ],
45
+ maxFiles: 4
46
+ },
47
+ parameters: {
48
+ site: {
49
+ description: 'Existing site actor name.',
50
+ required: true
51
+ },
52
+ taskName: {
53
+ description: 'Task name to add or update, for example submitContactForm or applyToJob.',
54
+ required: true
55
+ },
56
+ instructions: {
57
+ description: 'Form URL, selectors, field mapping, optional fields, submit behavior, and expected output.',
58
+ required: false
59
+ }
60
+ },
61
+ examples: [
62
+ 'src/core/Actor.ts',
63
+ 'src/sites/example/example.actor.ts',
64
+ 'src/sites/example/example.selectors.ts',
65
+ 'src/sites/example/example.types.ts',
66
+ 'tests/unit/core/defineActor.test.ts'
67
+ ],
68
+ context: [
69
+ {
70
+ kind: 'path',
71
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.actor.ts',
72
+ description: 'Actor that owns the form task.',
73
+ required: true
74
+ },
75
+ {
76
+ kind: 'path',
77
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.selectors.ts',
78
+ description: 'Form selectors used by the task.',
79
+ required: false
80
+ },
81
+ {
82
+ kind: 'path',
83
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.types.ts',
84
+ description: 'Typed task input/output contracts.',
85
+ required: false
86
+ },
87
+ {
88
+ kind: 'path',
89
+ path: 'src/core/Actor.ts',
90
+ description: 'defineFormTask and defineFormFillerTask definitions.'
91
+ },
92
+ {
93
+ kind: 'path',
94
+ path: 'src/core/ActorContext.ts',
95
+ description: 'Context services available to tasks and resolvers.'
96
+ },
97
+ {
98
+ kind: 'path',
99
+ path: 'tests/fixtures/makeContext.ts',
100
+ description: 'Context fixture for deterministic unit tests.'
101
+ },
102
+ {
103
+ kind: 'path',
104
+ path: 'tests/fixtures/FakePage.ts',
105
+ description: 'Fake page fixture for selector and navigation assertions.'
106
+ },
107
+ {
108
+ kind: 'path',
109
+ path: 'tests/fixtures/FakeCursor.ts',
110
+ description: 'Fake cursor fixture for typed/click assertions.'
111
+ }
112
+ ],
113
+ keywordContexts: [
114
+ {
115
+ keywords: ['optional', 'required false', 'nullable'],
116
+ context: [
117
+ {
118
+ kind: 'path',
119
+ path: 'src/core/Actor.ts',
120
+ description: 'Form task required-field semantics.'
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ keywords: ['navigation', 'waitForNavigation', 'submit'],
126
+ context: [
127
+ {
128
+ kind: 'path',
129
+ path: 'src/core/Actor.ts',
130
+ description: 'Submit behavior and navigation wait handling.'
131
+ }
132
+ ]
133
+ }
134
+ ],
135
+ tooling: {
136
+ allowGetExistingCode: true,
137
+ allowFindFiles: true,
138
+ allowSearchRepo: true
139
+ }
140
+ };
@@ -0,0 +1,122 @@
1
+ export default {
2
+ id: 'actor-task',
3
+ description: 'Add or update a task on an existing site actor, including selectors, types, extraction logic, and tests.',
4
+ instructions: `
5
+ Add or revise an actor task for an existing site.
6
+
7
+ Rules:
8
+ - Add the task to the actor.tasks object without breaking existing tasks.
9
+ - Use explicit input and output types in the site's .types.ts file.
10
+ - Use context.nav for URL/path navigation.
11
+ - Use context.forms and context.cursor for interactions.
12
+ - Use context.extract and context.pagination for scraping/extraction.
13
+ - Put new selectors in the site's .selectors.ts file and keep names descriptive.
14
+ - Normalize returned data into typed objects rather than returning raw DOM strings when the task output is known.
15
+ - Add unit tests for branching behavior, extraction logic, and pagination when applicable.
16
+ - Keep tests deterministic by using FakePage, FakeCursor, FakeCredentialsProvider, and makeContext where useful.
17
+
18
+ DO NOT call Puppeteer directly unless the PageAdapter/Extractor abstractions cannot express the operation.
19
+ DO NOT add broad sleeps when selector waits or navigation waits are more precise.
20
+ `.trim(),
21
+ output: {
22
+ pathTemplates: [
23
+ {
24
+ key: 'actor',
25
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.actor.ts',
26
+ description: 'The site actor to update with the new or changed task.'
27
+ },
28
+ {
29
+ key: 'selectors',
30
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.selectors.ts',
31
+ description: 'Selectors used by the task.'
32
+ },
33
+ {
34
+ key: 'types',
35
+ pathTemplate: 'src/sites/{{siteKebab}}/{{siteKebab}}.types.ts',
36
+ description: 'Task input and output types.'
37
+ },
38
+ {
39
+ key: 'tests',
40
+ pathTemplate: 'tests/unit/sites/{{siteKebab}}.{{taskName}}.test.ts',
41
+ description: 'Focused unit tests for the new task.'
42
+ }
43
+ ],
44
+ maxFiles: 4
45
+ },
46
+ parameters: {
47
+ site: {
48
+ description: 'Existing site actor name.',
49
+ required: true
50
+ },
51
+ taskName: {
52
+ description: 'Task name to add or update, for example scrapeDashboard, scrapeListings, downloadInvoices.',
53
+ required: true
54
+ },
55
+ instructions: {
56
+ description: 'Detailed behavior, selectors, inputs, outputs, and edge cases for the task.',
57
+ required: false
58
+ }
59
+ },
60
+ examples: [
61
+ 'src/sites/example/example.actor.ts',
62
+ 'src/sites/example/example.selectors.ts',
63
+ 'src/sites/example/example.types.ts',
64
+ 'tests/unit/extraction/Extractor.test.ts',
65
+ 'tests/unit/extraction/Pagination.test.ts'
66
+ ],
67
+ context: [
68
+ {
69
+ kind: 'path',
70
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.actor.ts',
71
+ description: 'Existing actor that owns the task.',
72
+ required: true
73
+ },
74
+ {
75
+ kind: 'path',
76
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.selectors.ts',
77
+ description: 'Existing site selectors.',
78
+ required: false
79
+ },
80
+ {
81
+ kind: 'path',
82
+ path: 'src/sites/{{siteKebab}}/{{siteKebab}}.types.ts',
83
+ description: 'Existing site task types.',
84
+ required: false
85
+ },
86
+ { kind: 'path', path: 'src/core/Actor.ts', description: 'Task contract.' },
87
+ { kind: 'path', path: 'src/core/ActorContext.ts', description: 'Context helpers exposed to the task.' },
88
+ { kind: 'path', path: 'src/extraction/Extractor.ts', description: 'Reusable extraction methods.' },
89
+ { kind: 'path', path: 'src/extraction/Pagination.ts', description: 'Reusable pagination methods.' },
90
+ { kind: 'path', path: 'src/interaction/Navigation.ts', description: 'Navigation helper.' },
91
+ { kind: 'path', path: 'src/interaction/Forms.ts', description: 'Form helper.' },
92
+ { kind: 'path', path: 'tests/fixtures/makeContext.ts', description: 'ActorContext factory for unit tests.' },
93
+ { kind: 'path', path: 'tests/fixtures/FakePage.ts', description: 'Fake page fixture for task tests.' },
94
+ { kind: 'path', path: 'tests/fixtures/FakeCursor.ts', description: 'Fake cursor fixture for task tests.' }
95
+ ],
96
+ keywordContexts: [
97
+ {
98
+ keywords: ['pagination', 'next page', 'maxPages', 'deduplicate'],
99
+ context: [
100
+ { kind: 'path', path: 'tests/unit/extraction/Pagination.test.ts', description: 'Pagination test patterns.' }
101
+ ]
102
+ },
103
+ {
104
+ keywords: ['table', 'jsonld', 'json-ld', 'href', 'attribute', 'textList'],
105
+ context: [
106
+ { kind: 'path', path: 'tests/unit/extraction/Extractor.test.ts', description: 'Extractor test patterns.' }
107
+ ]
108
+ },
109
+ {
110
+ keywords: ['login', 'auth', 'requires auth'],
111
+ context: [
112
+ { kind: 'path', path: 'src/auth/LoginFlow.types.ts', description: 'Actor auth config available before tasks run.' },
113
+ { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Auth is ensured before task execution.' }
114
+ ]
115
+ }
116
+ ],
117
+ tooling: {
118
+ allowGetExistingCode: true,
119
+ allowFindFiles: true,
120
+ allowSearchRepo: true
121
+ }
122
+ };
@@ -0,0 +1,126 @@
1
+ export default {
2
+ id: 'auth-core',
3
+ description: 'Modify authentication infrastructure: credentials providers, auth state detection, login flow execution, session snapshots, and auth tests.',
4
+ instructions: `
5
+ Modify the authentication layer while preserving the standardized site login API.
6
+
7
+ Rules:
8
+ - LoginFlowDefinition and LoginStep types are public-ish contracts for site authors; preserve compatibility when possible.
9
+ - Keep credentials abstracted through CredentialsProvider.
10
+ - Never log raw passwords, tokens, cookies, or secret values.
11
+ - Use redact() for logging sensitive credential metadata.
12
+ - Keep AuthStateDetector focused on deciding whether the current profile/session is already logged in.
13
+ - Keep LoginFlow responsible for executing simple and multi-step flows.
14
+ - If login step semantics change, update LoginFlow.types.ts and LoginFlow.test.ts.
15
+ - If field typing/clearing behavior changes, coordinate with Forms, FieldClearer, and HumanTyping.
16
+ - If session snapshots change, keep them optional because existing Chrome profile state is the primary session store.
17
+
18
+ DO NOT add CAPTCHA bypass, 2FA bypass, or anti-bot circumvention.
19
+ DO NOT store credentials in session snapshots.
20
+ `.trim(),
21
+ output: {
22
+ pathTemplates: [
23
+ {
24
+ key: 'login-types',
25
+ pathTemplate: 'src/auth/LoginFlow.types.ts',
26
+ description: 'Login flow public types and config shape.'
27
+ },
28
+ {
29
+ key: 'login-flow',
30
+ pathTemplate: 'src/auth/LoginFlow.ts',
31
+ description: 'Login flow execution behavior.'
32
+ },
33
+ {
34
+ key: 'credentials',
35
+ pathTemplate: 'src/auth/CredentialsProvider.ts',
36
+ description: 'Credential providers and credential references.'
37
+ },
38
+ {
39
+ key: 'detector',
40
+ pathTemplate: 'src/auth/AuthStateDetector.ts',
41
+ description: 'Logged-in state detection.'
42
+ },
43
+ {
44
+ key: 'session-store',
45
+ pathTemplate: 'src/auth/SessionStore.ts',
46
+ description: 'Optional session snapshot abstraction.'
47
+ },
48
+ {
49
+ key: 'auth-index',
50
+ pathTemplate: 'src/auth/index.ts',
51
+ description: 'Auth barrel exports.'
52
+ },
53
+ {
54
+ key: 'tests',
55
+ pathTemplate: 'tests/unit/auth/{{componentPascal}}.test.ts',
56
+ description: 'Auth unit tests for changed behavior.'
57
+ },
58
+ {
59
+ key: 'fake-credentials',
60
+ pathTemplate: 'tests/fixtures/FakeCredentialsProvider.ts',
61
+ description: 'Test credential provider fixture.'
62
+ }
63
+ ],
64
+ maxFiles: 8
65
+ },
66
+ parameters: {
67
+ component: {
68
+ description: 'Auth component or behavior to edit, for example LoginFlow, multi-step steps, credentials, auth detection, or session store.',
69
+ required: true
70
+ },
71
+ instructions: {
72
+ description: 'Specific auth behavior, config shape, step semantics, or failure handling to implement.',
73
+ required: false
74
+ }
75
+ },
76
+ examples: [
77
+ 'src/auth/LoginFlow.types.ts',
78
+ 'src/auth/LoginFlow.ts',
79
+ 'src/auth/CredentialsProvider.ts',
80
+ 'tests/unit/auth/LoginFlow.test.ts',
81
+ 'tests/unit/auth/AuthStateDetector.test.ts'
82
+ ],
83
+ context: [
84
+ { kind: 'path', path: 'src/auth/LoginFlow.types.ts', description: 'Auth config and login step types.' },
85
+ { kind: 'path', path: 'src/auth/LoginFlow.ts', description: 'Login execution.' },
86
+ { kind: 'path', path: 'src/auth/CredentialsProvider.ts', description: 'Credential provider model.' },
87
+ { kind: 'path', path: 'src/auth/AuthStateDetector.ts', description: 'Auth state detection.' },
88
+ { kind: 'path', path: 'src/auth/SessionStore.ts', description: 'Optional session store.' },
89
+ { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'Ensures auth before tasks.' },
90
+ { kind: 'path', path: 'src/core/ActorContext.ts', description: 'Auth controller available to actors.' },
91
+ { kind: 'path', path: 'src/utils/redact.ts', description: 'Sensitive data redaction.' },
92
+ { kind: 'path', path: 'src/interaction/Forms.ts', description: 'Login fill steps use FormFiller.' },
93
+ { kind: 'path', path: 'src/interaction/FieldClearer.ts', description: 'Field clearing used by login fills.' },
94
+ { kind: 'path', path: 'src/interaction/HumanTyping.ts', description: 'Typing options for login fills.' },
95
+ { kind: 'path', path: 'tests/unit/auth/LoginFlow.test.ts', description: 'Login flow tests.' },
96
+ { kind: 'path', path: 'tests/unit/auth/AuthStateDetector.test.ts', description: 'Detector tests.' },
97
+ { kind: 'path', path: 'tests/fixtures/makeContext.ts', description: 'Test context factory.' }
98
+ ],
99
+ keywordContexts: [
100
+ {
101
+ keywords: ['multi-step', 'multistep', 'steps', 'waitForSelector', 'hook'],
102
+ context: [
103
+ { kind: 'path', path: 'src/sites/example/example.actor.ts', description: 'Example login config shape.' }
104
+ ]
105
+ },
106
+ {
107
+ keywords: ['logging', 'redact', 'secret', 'password', 'token'],
108
+ context: [
109
+ { kind: 'path', path: 'tests/unit/logging/redact.test.ts', description: 'Redaction test expectations.' },
110
+ { kind: 'path', path: 'src/logging/Logger.ts', description: 'Logger interface.' }
111
+ ]
112
+ },
113
+ {
114
+ keywords: ['browser profile', 'existing profile', 'cookies', 'localStorage'],
115
+ context: [
116
+ { kind: 'path', path: 'src/browser/RuntimeConfig.ts', description: 'Existing Chrome profile config model.' },
117
+ { kind: 'path', path: 'src/browser/BrowserSession.ts', description: 'Browser session behavior.' }
118
+ ]
119
+ }
120
+ ],
121
+ tooling: {
122
+ allowGetExistingCode: true,
123
+ allowFindFiles: true,
124
+ allowSearchRepo: true
125
+ }
126
+ };
@@ -0,0 +1,114 @@
1
+ export default {
2
+ id: 'browser-runtime',
3
+ description: 'Modify Chrome launch/connect/runtime configuration, existing profile handling, remote debugging attach, profile validation, or session lifecycle.',
4
+ instructions: `
5
+ Update browser runtime behavior while preserving the existing-profile and remote-debugging modes.
6
+
7
+ Rules:
8
+ - Existing-profile mode must use userDataDir and optional --profile-directory.
9
+ - Existing-profile mode must use browser.defaultBrowserContext(), not a new isolated context.
10
+ - If a profile is already running and fallback is enabled, connect to the configured local DevTools endpoint.
11
+ - Remote-debugging mode should disconnect by default, not close the shared Chrome process.
12
+ - Keep RuntimeConfig normalized so defaults are centralized and tests are deterministic.
13
+ - Keep BrowserFactory testable through PuppeteerLike abstractions.
14
+ - Validate paths and endpoint configuration in profileValidation.ts.
15
+ - Add or update BrowserFactory tests for every launch/connect branch and error path.
16
+ - Update CLI env parsing and README examples when runtime config surface changes.
17
+
18
+ DO NOT add code that binds Chrome debugging to a public network interface by default.
19
+ DO NOT create incognito/isolated browser contexts for existing-profile mode.
20
+ `.trim(),
21
+ output: {
22
+ pathTemplates: [
23
+ {
24
+ key: 'runtime-config',
25
+ pathTemplate: 'src/browser/RuntimeConfig.ts',
26
+ description: 'Runtime config types, defaults, and normalization.'
27
+ },
28
+ {
29
+ key: 'browser-factory',
30
+ pathTemplate: 'src/browser/BrowserFactory.ts',
31
+ description: 'Chrome launch/connect/session preparation logic.'
32
+ },
33
+ {
34
+ key: 'browser-session',
35
+ pathTemplate: 'src/browser/BrowserSession.ts',
36
+ description: 'Close/disconnect behavior for launched vs connected browsers.'
37
+ },
38
+ {
39
+ key: 'validation',
40
+ pathTemplate: 'src/browser/profileValidation.ts',
41
+ description: 'Profile directory and remote debugging endpoint validation.'
42
+ },
43
+ {
44
+ key: 'cli',
45
+ pathTemplate: 'src/cli/run.ts',
46
+ description: 'Environment variable parsing for runtime config.'
47
+ },
48
+ {
49
+ key: 'tests',
50
+ pathTemplate: 'tests/unit/browser/BrowserFactory.test.ts',
51
+ description: 'Unit tests for browser launch/connect behavior.'
52
+ },
53
+ {
54
+ key: 'docs',
55
+ pathTemplate: 'README.md',
56
+ description: 'Runtime setup and debug endpoint documentation.'
57
+ }
58
+ ],
59
+ maxFiles: 7
60
+ },
61
+ parameters: {
62
+ feature: {
63
+ description: 'Browser/runtime feature to add or change, for example remote-debugging, existing profile validation, tab reuse, or timeouts.',
64
+ required: true
65
+ },
66
+ instructions: {
67
+ description: 'Specific behavior, env vars, error handling, and compatibility constraints.',
68
+ required: false
69
+ }
70
+ },
71
+ examples: [
72
+ 'src/browser/RuntimeConfig.ts',
73
+ 'src/browser/BrowserFactory.ts',
74
+ 'src/browser/BrowserSession.ts',
75
+ 'src/browser/profileValidation.ts',
76
+ 'tests/unit/browser/BrowserFactory.test.ts'
77
+ ],
78
+ context: [
79
+ { kind: 'path', path: 'src/browser/RuntimeConfig.ts', description: 'Runtime config model and normalization.' },
80
+ { kind: 'path', path: 'src/browser/BrowserFactory.ts', description: 'Launch/connect implementation.' },
81
+ { kind: 'path', path: 'src/browser/BrowserSession.ts', description: 'Session lifecycle behavior.' },
82
+ { kind: 'path', path: 'src/browser/profileValidation.ts', description: 'Validation helpers.' },
83
+ { kind: 'path', path: 'src/browser/PuppeteerLike.ts', description: 'Testable Puppeteer interfaces.' },
84
+ { kind: 'path', path: 'src/core/ActorRunner.ts', description: 'How BrowserFactory is invoked.' },
85
+ { kind: 'path', path: 'src/cli/run.ts', description: 'CLI runtime config construction.' },
86
+ { kind: 'path', path: 'tests/unit/browser/BrowserFactory.test.ts', description: 'Existing browser runtime tests.' }
87
+ ],
88
+ keywordContexts: [
89
+ {
90
+ keywords: ['cli', 'env', 'environment variable', 'CHROME_USER_DATA_DIR', 'CHROME_REMOTE_DEBUGGING_PORT'],
91
+ context: [
92
+ { kind: 'path', path: 'README.md', description: 'CLI/runtime docs that should remain accurate.' }
93
+ ]
94
+ },
95
+ {
96
+ keywords: ['actor runner', 'cleanup', 'close', 'disconnect'],
97
+ context: [
98
+ { kind: 'path', path: 'tests/unit/core/ActorRunner.test.ts', description: 'Runner cleanup behavior tests.' }
99
+ ]
100
+ },
101
+ {
102
+ keywords: ['typing', 'interaction', 'cursor'],
103
+ context: [
104
+ { kind: 'path', path: 'src/interaction/HumanTyping.ts', description: 'Interaction config nested in RuntimeConfig.' },
105
+ { kind: 'path', path: 'src/interaction/GhostCursorAdapter.ts', description: 'Runtime config is passed into interactor construction.' }
106
+ ]
107
+ }
108
+ ],
109
+ tooling: {
110
+ allowGetExistingCode: true,
111
+ allowFindFiles: true,
112
+ allowSearchRepo: true
113
+ }
114
+ };
@@ -0,0 +1,96 @@
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
+ };