@foldspace_npm/harness 0.1.26 → 0.1.28

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 (120) hide show
  1. package/CLAUDE.md +402 -204
  2. package/README.md +84 -36
  3. package/bin/ask.mjs +19 -9
  4. package/bin/attach.mjs +91 -56
  5. package/bin/badge.mjs +28 -8
  6. package/bin/cli.mjs +23 -6
  7. package/bin/inject.mjs +3 -4
  8. package/bin/observe.mjs +22 -6
  9. package/bin/published.mjs +141 -0
  10. package/package.json +6 -2
  11. package/recipes/INDEX.md +13 -8
  12. package/recipes/README.md +30 -7
  13. package/recipes/account-overview/README.md +6 -6
  14. package/recipes/account-overview/agent/actions/show_account_overview.ts +11 -16
  15. package/recipes/account-overview/agent/views/brand.ts +23 -14
  16. package/recipes/account-overview/agent/views/overview.ts +13 -17
  17. package/recipes/bottom-bar/README.md +12 -9
  18. package/recipes/bottom-bar/agent/bottomBar.ts +14 -12
  19. package/recipes/create-a-record/README.md +97 -0
  20. package/recipes/create-a-record/agent/actions/create_project.ts +26 -0
  21. package/recipes/create-a-record/agent/api/projects.ts +62 -0
  22. package/recipes/create-a-record/agent/projects.ts +145 -0
  23. package/recipes/create-a-record/agent/views/approval.ts +181 -0
  24. package/recipes/create-a-record/agent/views/brand.ts +35 -0
  25. package/recipes/create-a-record/agent/views/fields.ts +252 -0
  26. package/recipes/create-a-record/agent/views/project-card.ts +253 -0
  27. package/recipes/create-a-record/agent/views/steps.ts +92 -0
  28. package/recipes/create-a-record/fixtures/owners.ok.json +9 -0
  29. package/recipes/create-a-record/fixtures/project.created.json +1 -0
  30. package/recipes/create-a-record/fixtures/project.rejected.json +1 -0
  31. package/recipes/create-a-record/recipe.json +13 -0
  32. package/recipes/create-a-record/variants/actions/create_project.steps.ts +160 -0
  33. package/recipes/find-by-name/README.md +3 -1
  34. package/recipes/find-by-name/agent/actions/find_project_id.ts +1 -1
  35. package/recipes/lookup-then-view/README.md +73 -0
  36. package/recipes/lookup-then-view/agent/accounts.ts +174 -0
  37. package/recipes/lookup-then-view/agent/actions/find_account.ts +108 -0
  38. package/recipes/lookup-then-view/agent/actions/show_account_overview.ts +42 -0
  39. package/recipes/lookup-then-view/agent/api/accounts.ts +68 -0
  40. package/recipes/lookup-then-view/agent/views/account.ts +183 -0
  41. package/recipes/lookup-then-view/agent/views/brand.ts +35 -0
  42. package/recipes/lookup-then-view/agent/views/format.ts +73 -0
  43. package/recipes/lookup-then-view/agent/views/pick-one.ts +240 -0
  44. package/recipes/lookup-then-view/fixtures/accounts.json +319 -0
  45. package/recipes/lookup-then-view/fixtures/overview.ok.json +122 -0
  46. package/recipes/lookup-then-view/fixtures/overview.unsigned.json +14 -0
  47. package/recipes/lookup-then-view/recipe.json +11 -0
  48. package/recipes/lookup-then-view/studio/find_account.json +10 -0
  49. package/recipes/lookup-then-view/studio/show_account_overview.json +15 -0
  50. package/recipes/opportunities-at-risk/README.md +5 -5
  51. package/recipes/opportunities-at-risk/agent/actions/show_opportunities_at_risk.ts +9 -7
  52. package/recipes/opportunities-at-risk/agent/opportunities.ts +11 -10
  53. package/recipes/opportunities-at-risk/agent/views/at-risk.ts +1 -1
  54. package/recipes/opportunities-at-risk/agent/views/brand.ts +26 -15
  55. package/recipes/pick-from-a-list/README.md +7 -6
  56. package/recipes/pick-from-a-list/agent/actions/choose_project.ts +27 -12
  57. package/recipes/pick-from-a-list/agent/views/brand.ts +30 -9
  58. package/recipes/pick-from-a-list/agent/views/picker.ts +3 -3
  59. package/recipes/prepare-for-a-meeting/README.md +4 -4
  60. package/recipes/prepare-for-a-meeting/agent/actions/prepare_for_meeting.ts +3 -3
  61. package/recipes/records-list/README.md +6 -6
  62. package/recipes/records-list/agent/accounts.ts +3 -1
  63. package/recipes/records-list/agent/actions/list_accounts.ts +7 -7
  64. package/recipes/records-list/agent/views/brand.ts +26 -14
  65. package/recipes/server-rendered-forms/README.md +35 -0
  66. package/recipes/server-rendered-forms/agent/actions/create_record_via_form.ts +62 -0
  67. package/recipes/server-rendered-forms/agent/api/pages.ts +57 -0
  68. package/recipes/server-rendered-forms/agent/forms.ts +192 -0
  69. package/recipes/server-rendered-forms/fixtures/form.errors.html +9 -0
  70. package/recipes/server-rendered-forms/fixtures/form.html +17 -0
  71. package/recipes/server-rendered-forms/fixtures/list.html +9 -0
  72. package/recipes/server-rendered-forms/fixtures/record.html +4 -0
  73. package/recipes/server-rendered-forms/recipe.json +10 -0
  74. package/recipes/several-hosts/README.md +10 -13
  75. package/recipes/several-hosts/agent/hosts.ts +19 -136
  76. package/recipes/several-hosts/fixtures/wrong-page.json +6 -0
  77. package/recipes/several-hosts/recipe.json +3 -3
  78. package/recipes/swap-the-login-method/README.md +16 -5
  79. package/recipes/swap-the-login-method/agent/utils.ts +52 -3
  80. package/recipes/swap-the-login-method/variants/utils.cookies.ts +59 -6
  81. package/recipes/update-meeting-notes/README.md +10 -4
  82. package/recipes/update-meeting-notes/agent/actions/update_meeting_notes.ts +16 -5
  83. package/recipes/upload-contacts/README.md +5 -5
  84. package/recipes/upload-contacts/agent/actions/upload_contacts.ts +7 -7
  85. package/recipes/upload-contacts/agent/views/brand.ts +24 -14
  86. package/recipes/upload-contacts/agent/views/uploader.ts +28 -17
  87. package/recipes/who-is-the-user/README.md +7 -3
  88. package/src/ask-core.mjs +16 -4
  89. package/src/attach-daemon.mjs +9 -2
  90. package/src/attach-helpers.mjs +105 -0
  91. package/src/attach-preflight.mjs +34 -11
  92. package/src/badge-core.mjs +1 -1
  93. package/src/cdp-client.mjs +15 -19
  94. package/src/cdp-ownership.mjs +41 -20
  95. package/src/cli-help.mjs +7 -5
  96. package/src/cli-registry.mjs +102 -47
  97. package/src/diagnostics.mjs +1 -1
  98. package/src/init.mjs +5 -3
  99. package/src/keep-focus.mjs +17 -13
  100. package/src/lint/index.mjs +8 -1
  101. package/src/lint/rules.mjs +240 -43
  102. package/src/observe-core.mjs +163 -34
  103. package/src/published-core.mjs +392 -0
  104. package/src/region.mjs +1 -1
  105. package/src/runtime/agent.ts +16 -12
  106. package/src/runtime/http.ts +25 -15
  107. package/src/runtime/match.ts +1 -1
  108. package/src/runtime/render.ts +4 -4
  109. package/src/transports/README.md +2 -2
  110. package/src/upgrade.mjs +33 -10
  111. package/templates/agent-starter/CLAUDE.md +8 -5
  112. package/templates/agent-starter/README.md +32 -33
  113. package/templates/agent-starter/agent/actions/_example.ts +4 -4
  114. package/templates/agent-starter/agent/actions/index.ts +2 -2
  115. package/templates/agent-starter/agent/constants.ts +4 -3
  116. package/templates/agent-starter/agent/utils.ts +15 -18
  117. package/templates/agent-starter/claude-settings.json +2 -1
  118. package/templates/agent-starter/docs/app-profile.md +19 -14
  119. package/templates/agent-starter/foldspace.dev.json +1 -1
  120. package/recipes/several-hosts/fixtures/nav-record.json +0 -5
@@ -3,9 +3,10 @@
3
3
  Durable facts about `{{APP_DOMAIN}}` and its API, established by observing the
4
4
  running app on **<date>** from a logged-in session.
5
5
 
6
- **Everything here should be observed.** Each entry says how. Where something is
7
- only believed, say so in the same breath — do not promote an assumption by
8
- quoting this file. Re-run the probe before trusting an entry that matters.
6
+ **Every entry says how it was established.** Where something is only
7
+ believed, mark it **assumed** in the same breath - do not promote an
8
+ assumption by quoting this file. Re-run the probe before trusting an entry
9
+ that matters.
9
10
 
10
11
  Do not store secrets, cookies, HAR files, tokens, or session data here. Record
11
12
  *where* the token lives and *what a redacted value looks like*, never the value.
@@ -13,9 +14,9 @@ Do not store secrets, cookies, HAR files, tokens, or session data here. Record
13
14
  How to re-run any probe below:
14
15
 
15
16
  ```bash
16
- npm run inject
17
- # Sign in, then read the running app with foldspace observe. It reads the
18
- # window you signed in to, and works while foldspace attach runs.
17
+ npm run inject # only if the test window is closed; the human signs in there
18
+ npx foldspace observe wait-login
19
+ # observe reads the test window, and works while attach runs.
19
20
  npx foldspace observe screen --click "<a label from observe menu>" --match "<words for the data>"
20
21
  npx foldspace observe read "<the GET path screen returned>"
21
22
  ```
@@ -27,9 +28,9 @@ Start URL: `{{START_URL}}`
27
28
  ## Auth
28
29
 
29
30
  - Where the token lives (cookie name, `localStorage` key, custom header), and
30
- how you know — wrapping XHR/`fetch` on the live page beats guessing.
31
- - Its lifetime, measured. (One app's expired in ~52 minutes and killed three
32
- probing sessions.)
31
+ how you know: `npx foldspace observe auth` reports where each header value
32
+ comes from, never the value.
33
+ - Its lifetime, measured: a short one ends probing sessions halfway.
33
34
  - What an expired or refused response looks like, verbatim. A CORS-less refusal
34
35
  often surfaces as `TypeError: Failed to fetch` with no status — that is not
35
36
  "host down".
@@ -43,8 +44,11 @@ Start URL: `{{START_URL}}`
43
44
 
44
45
  ## Account contents
45
46
 
46
- Row counts from the signed-in account **before** choosing the experience. On an
47
- empty account the only useful first action is one that creates data.
47
+ Row counts for the experience being built, checked when you observe it. Zero
48
+ rows makes a demo of an empty state: say so and offer the next experience. On
49
+ an account with nothing to read at all, say so and offer first a card that
50
+ creates a record when the end user approves
51
+ (`node_modules/@foldspace_npm/harness/recipes/create-a-record`).
48
52
 
49
53
  | Resource | Count | How established |
50
54
  |---|---|---|
@@ -93,9 +97,10 @@ Mark which you verified and which came from reading the app bundle.
93
97
 
94
98
  ## Brand (sampled, not guessed)
95
99
 
96
- Colour, typeface, greys, base size and radii from the running app's computed
97
- styles — not from a screenshot. Re-sample per tenant; do not carry values
98
- across.
100
+ `npx foldspace observe styles --write` samples the app's accent, text, border,
101
+ font and radius and writes `agent/views/brand.ts`. Record here the page and
102
+ date it sampled, and anything it fell back on. Re-sample per product; never
103
+ copy values across.
99
104
 
100
105
  ## Endpoints seen in the bundle but NOT called
101
106
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "Generated by foldspace init. Use the bare product ID, not the EU-… SDK key.",
2
+ "$comment": "Generated by foldspace init. Use the bare product ID, not the SDK key (the one that starts with EU-, in every region).",
3
3
  "defaultTarget": "app",
4
4
  "region": {{REGION_JSON}},
5
5
  "sdkUrl": {{SDK_URL_JSON}},
@@ -1,5 +0,0 @@
1
- {
2
- "payload": { "conversationId": "conv_123", "actionName": "navigate" },
3
- "normalizedUrl": "https://communicate.example-campus.net/applications/acme/test",
4
- "expiry": 9999999999999
5
- }