@foldspace_npm/harness 0.1.2 → 0.1.4

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  # @foldspace_npm/harness
2
2
 
3
- Build, inject and verify Foldspace agent experiences against a live app.
3
+ Build the portable `dist/index.js` action artifact and verify it against a live
4
+ app.
4
5
 
5
6
  **This package is the part that is the same in both architectures.** Everything
6
7
  else about how a builder runs differs between them; this does not.
@@ -13,7 +14,7 @@ else about how a builder runs differs between them; this does not.
13
14
  |---|---|---|
14
15
  | Who runs the agent | Claude Code on the builder's desktop | Claude Agent SDK in GCP |
15
16
  | Whose browser | an isolated Chrome the harness launches | the user's **own** Chrome |
16
- | How code reaches the page | CDP injection | Web Store extension injects a `<script src>` from the CDN |
17
+ | How code reaches the page | harness CDP preparation | builder extension loads the cloud artifact |
17
18
  | Prerequisites | Claude Code, a client repo, Node, an isolated Chrome profile | the extension installed |
18
19
  | Session and cookies | in a profile the harness creates | the user's own, untouched |
19
20
  | Code and history | a git repo on the builder's machine | a workspace in the hosted environment |
@@ -50,13 +51,36 @@ exact failure this package was created to end. And the verb interface only stays
50
51
  honest while both implementations sit behind it; separate them and "the same
51
52
  action runs in both modes" quietly stops being true.
52
53
 
53
- A hosted container installs this and never calls `inject`. That is kilobytes of
54
- dead weight, against a contract that cannot drift.
54
+ A hosted environment uses the same action source and build contract, but local
55
+ `inject` and `attach` remain CDP-only commands. The harness does not generate a
56
+ customer application extension.
55
57
 
56
58
  ---
57
59
 
58
60
  ## Use
59
61
 
62
+ ### Discover the CLI
63
+
64
+ Human-readable help is grouped by workflow:
65
+
66
+ ```bash
67
+ foldspace help
68
+ foldspace help attach
69
+ ```
70
+
71
+ Coding agents can inspect the same versioned command and capability contract:
72
+
73
+ ```bash
74
+ foldspace help --json
75
+ foldspace help attach --json
76
+ ```
77
+
78
+ The installed `harness` binary is an alias for `foldspace`.
79
+
80
+ The JSON describes current options, prerequisites, side effects, risks,
81
+ capabilities, and next steps. It does not claim that future hosted-environment
82
+ capability enforcement is already implemented.
83
+
60
84
  ### Create a project
61
85
 
62
86
  Create a configured actions project from the template bundled with the installed
@@ -71,7 +95,7 @@ Non-interactive / CI form:
71
95
  ```bash
72
96
  npx --yes @foldspace_npm/harness init my-agent \
73
97
  --product-id FR8JUQZAQRZB \
74
- --agent-api-name my-agent \
98
+ --agent-key my-agent \
75
99
  --domain app.example.com \
76
100
  --name "My Agent"
77
101
  ```
@@ -81,12 +105,14 @@ When running directly from a harness checkout during development:
81
105
  ```bash
82
106
  node bin/cli.mjs init ../my-agent \
83
107
  --product-id FR8JUQZAQRZB \
84
- --agent-api-name my-agent \
108
+ --agent-key my-agent \
85
109
  --domain app.example.com
86
110
  ```
87
111
 
88
- `--name` is optional and defaults to the target directory name. The product ID
89
- must be the bare ID, not an `EU-…` SDK key. The domain may be a hostname or an
112
+ The Agent Key is the value shown in Agent Studio, such as `my-agent`.
113
+ `--agent-api-name` remains a deprecated alias for `--agent-key`. `--name` is
114
+ optional and defaults to the target directory name. The product ID must be the
115
+ bare ID, not the `EU-…-1-1` SDK loader key. The domain may be a hostname or an
90
116
  HTTP(S) URL without a port or path.
91
117
 
92
118
  For safety, `init` requires a target path that does not exist. It does not
@@ -104,6 +130,35 @@ npm run attach
104
130
  The generated npm scripts intentionally remain the normal project interface;
105
131
  `foldspace init` is the one-time project creation command.
106
132
 
133
+ ### Choose an attach mode
134
+
135
+ - **Swap (default):** the page already uses the configured product and agent.
136
+ - **Bootstrap (`--bootstrap`):** the page has no Foldspace SDK.
137
+ - **Replace (`--replace`):** the page embeds a different product or agent, or
138
+ has an SDK without the configured agent.
139
+
140
+ Use `foldspace help attach` for mode requirements, effects, and safety options.
141
+
142
+ ### Verify actions through the agent
143
+
144
+ `foldspace attach` does not invoke action handlers directly. It loads the local
145
+ artifact, verifies that its action names exactly match the configured SDK agent,
146
+ and then observes action callbacks while you exercise the normal agent
147
+ experience.
148
+
149
+ Action output identifies SDK callbacks and local `execute`/`render` phases:
150
+
151
+ ```text
152
+ [actions] sdk:action show_account_360 executed
153
+ [actions] local-handler:execute show_account_360 succeeded 412ms
154
+ [actions] local-handler:render show_account_360 succeeded 18ms
155
+ ```
156
+
157
+ Only action names, parameter keys, statuses, and durations are recorded; handler
158
+ parameter values, results, and error messages are not. On detach, repeated page
159
+ failures and bounded action observations are summarized. The observer and
160
+ diagnostics are injected by the harness, so `dist/index.js` is not rewritten.
161
+
107
162
  ### Add the harness to an existing project
108
163
 
109
164
  ```bash
@@ -120,18 +175,14 @@ npm i -D @foldspace_npm/harness
120
175
  } }
121
176
  ```
122
177
 
123
- | Command | A | B |
124
- |---|:--:|:--:|
125
- | `foldspace init` | ✅ | ✅ |
126
- | `foldspace build` | ✅ | ✅ |
127
- | `foldspace deploy` | ✅ | ✅ — it *is* the delivery mechanism |
128
- | `foldspace inject` | ✅ | — no browser to launch |
129
- | `foldspace attach` | ✅ | replaced by the extension bridge |
130
-
131
178
  Every command resolves the **consuming** repo — `process.cwd()`, or
132
179
  `FOLDSPACE_PROJECT_DIR` so a hosted builder can point it at a workspace it
133
180
  controls. Config comes from the consumer's `foldspace.dev.json`.
134
181
 
182
+ `foldspace deploy` is an explicit remote publication step that reads product
183
+ and agent identity from the selected target in `foldspace.dev.json`. It requires
184
+ local cloud credentials and is separate from local verification.
185
+
135
186
  ---
136
187
 
137
188
  ## Why this package exists at all