@foldspace_npm/harness 0.1.6 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldspace_npm/harness",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Build and verify portable Foldspace action artifacts against a live app.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -53,6 +53,27 @@ Actions execute in the user's signed-in browser session.
53
53
  - Do not substitute a public developer API when the browser session is missing;
54
54
  ask the user to sign in.
55
55
  - Validate parameters and return sanitized errors.
56
+ - Actions that return data the user will inspect should include a `render`
57
+ function for in-chat UI (a chatterblock). If it makes more sense to output the data
58
+ in a UI component instead of text then consider using render to show a component.
59
+ - Check https://docs.foldspace.ai/guides/in-chat-ui/ for more information
60
+
61
+ ## Task agents
62
+
63
+ Use a Task Agent when the handler needs a one-time LLM subtask that
64
+ deterministic code cannot do well: extraction, summarization,
65
+ classification, normalization, enrichment, or generation.
66
+
67
+ Do not use a Task Agent for API calls, CRUD, routing, or parsing a
68
+ known response shape. Those stay in `execute`.
69
+
70
+ Task agents are created in Agent Studio, not in this repo. Ask before
71
+ creating or publishing one. Call a published task agent from the
72
+ handler with `runTask({ taskKey, data })` (if not published the runTask won't work).
73
+ Prefer JSON output when the handler must consume the result.
74
+
75
+ See https://docs.foldspace.ai/user-guides/task-agents/ and
76
+ https://docs.foldspace.ai/reference/task-agent-api/
56
77
 
57
78
  ## Local harness loop
58
79
 
@@ -109,7 +130,8 @@ Do not report success without all six:
109
130
 
110
131
  ## Layout
111
132
 
112
- - `agent/actions/` — one handler per action, registered in `index.ts`
133
+ - `agent/actions/` — one handler per action (`execute`, optional `render`),
134
+ registered in `index.ts`
113
135
  - `agent/api/` — one HTTP helper per endpoint
114
136
  - `agent/constants.ts` — agent, product, and domain identifiers
115
137
  - `agent/utils.ts` — Foldspace agent lookup
@@ -15,4 +15,19 @@ export const example_action = {
15
15
  return { ok: false, error: detail };
16
16
  }
17
17
  },
18
+
19
+ // Optional chatterblock: uncomment to render in-chat UI instead of
20
+ // returning text-only data. See https://docs.foldspace.ai/guides/in-chat-ui/ for more information. Set
21
+ // awaitUserInput: true for forms and confirmations.
22
+ //
23
+ // render: (data, host, header, callback, cancel) => {
24
+ // host.replaceChildren();
25
+ // if (data?.ok === false) {
26
+ // host.textContent = data.error;
27
+ // return;
28
+ // }
29
+ // const card = document.createElement("div");
30
+ // card.textContent = data.echo;
31
+ // host.append(card);
32
+ // },
18
33
  };