@foldspace_npm/harness 0.1.37 → 0.1.39
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/CLAUDE.md +37 -11
- package/package.json +1 -1
- package/recipes/README.md +4 -3
- package/recipes/account-overview/README.md +1 -1
- package/recipes/lookup-then-view/studio/show_account_overview.json +1 -1
- package/recipes/opportunities-at-risk/README.md +1 -1
- package/recipes/records-list/README.md +1 -1
- package/src/lint/rules.mjs +2 -2
package/CLAUDE.md
CHANGED
|
@@ -516,6 +516,14 @@ save or publish:**
|
|
|
516
516
|
<committed_paths, comma-separated>`, so your own save is not taken for
|
|
517
517
|
someone else's.
|
|
518
518
|
|
|
519
|
+
**None of this is said to the human.** No develop, lines of work, pulling,
|
|
520
|
+
merging, conflicts, commits or branches - not in a status line, not when
|
|
521
|
+
something goes wrong. When nobody else saved, say nothing. When someone did,
|
|
522
|
+
one line: *"I brought in changes a teammate saved."* When a file had changes
|
|
523
|
+
both here and in theirs, name the experience in their words: *"A teammate
|
|
524
|
+
also changed the patient table; I kept theirs and put my change on top."*
|
|
525
|
+
Updating the harness is *"updating the Foldspace tools"*, never pulling it.
|
|
526
|
+
|
|
519
527
|
## Done, and what you say at the end
|
|
520
528
|
|
|
521
529
|
A first session is done when the customer has seen one experience answer from
|
|
@@ -551,15 +559,27 @@ you offer the second wave:
|
|
|
551
559
|
again. If it works, invite them to try it in that window (a reload takes
|
|
552
560
|
it off dev), and run `npx foldspace attach --daemon` before you build
|
|
553
561
|
anything else. If `published` says this window cannot show dev, say so in
|
|
554
|
-
one sentence, attach again, and
|
|
562
|
+
one sentence, attach again, and do not offer production yourself - but
|
|
563
|
+
publish it when the human asks (below).
|
|
555
564
|
3. Once the dev check passed, ask before publishing for their users:
|
|
556
565
|
*"Shall I publish it for your users?"* On a yes, publish to production. On a not yet, it stays on dev:
|
|
557
566
|
say so in one line and carry on.
|
|
558
567
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
568
|
+
**Publishing for their users is the human's call, not a step they earn.**
|
|
569
|
+
When they ask for it - at any point, whether or not the dev check ran or
|
|
570
|
+
could run - that is the yes: publish to production the way `repo_read`
|
|
571
|
+
command `instructions` says, in that turn. Do not ask them to confirm again,
|
|
572
|
+
and do not explain the process. When dev was not checked, one line as you
|
|
573
|
+
publish: *"I couldn't check it on dev here, so it goes out as you tried it
|
|
574
|
+
in the test window."* Only a refusal from the Foldspace tools stops it (below).
|
|
575
|
+
|
|
576
|
+
Step 2 needs a site that loads this agent by itself. If you attached with
|
|
577
|
+
`--bootstrap` or `--replace`, it does not yet: do step 1, keep attach
|
|
578
|
+
running, and do not offer production yourself - their site loading the agent
|
|
579
|
+
is the step the Foldspace team does with them. When the human asks for
|
|
580
|
+
production anyway, publish it (above), and add one line: *"Your users will
|
|
581
|
+
see it once your site loads the agent - that's the step the Foldspace team
|
|
582
|
+
does with you."*
|
|
563
583
|
|
|
564
584
|
A save refused because someone saved after you read is not final: pull again
|
|
565
585
|
(**Several builders, one agent**), put your change on top and save. Any other refusal from the Foldspace tools
|
|
@@ -759,7 +779,8 @@ Each of these cost a real build.
|
|
|
759
779
|
callback, cancel, readyState)` decides which: a `render` that uses
|
|
760
780
|
`callback`, `cancel` or `readyState` is an input card, and the agent waits
|
|
761
781
|
until the card reports through one of them; one that uses none of them is
|
|
762
|
-
a view card.
|
|
782
|
+
a view card. Foldspace's docs call these **read-only** and **input**
|
|
783
|
+
cards; they mean the same thing.
|
|
763
784
|
- **A view card shows something** - an account, a list, deals at risk -
|
|
764
785
|
with `render(data, host, header)`: no `callback`, no `cancel`. As soon as
|
|
765
786
|
`render` returns, the agent gets "Shown to the user. The user has not
|
|
@@ -798,6 +819,14 @@ Each of these cost a real build.
|
|
|
798
819
|
choice, as fields**, with the state (chosen, declined, cancelled, failed)
|
|
799
820
|
and nothing about what to do next (**Rules**, 1). A view card needs no
|
|
800
821
|
state of its own: the SDK tells the agent it was shown.
|
|
822
|
+
- **Never report a view card through `callback`.** Calling `callback(data)`
|
|
823
|
+
right after drawing (the old way to get a card's data to the agent) tells
|
|
824
|
+
the agent the user submitted that data, and it replies as if they had.
|
|
825
|
+
A view card takes `render(data, host, header)`, or calls
|
|
826
|
+
`readyState(value)` to send less than `execute` returned.
|
|
827
|
+
- **The agent only knows what the card reports, not what it draws.** A
|
|
828
|
+
figure or date on the card that is not in that data is unknown to the
|
|
829
|
+
agent, so put every fact a follow-up question could need in it.
|
|
801
830
|
- **A failed or signed-out call is never drawn as zeros.** A signed-out response
|
|
802
831
|
often looks like a valid empty one: a 200 with zeros, nulls or an empty list.
|
|
803
832
|
Before you draw numbers, check that the response belongs to a signed-in user -
|
|
@@ -814,11 +843,8 @@ Each of these cost a real build.
|
|
|
814
843
|
code, from the API's own numbers - in `execute` for a view card, since its
|
|
815
844
|
result is what the agent gets - show them on the card, and hand the agent
|
|
816
845
|
the same figures. In the action's Studio `instructions`, tell the agent to
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
line items will eventually add them up wrong), and, right after a view
|
|
820
|
-
card, to say one short sentence at most - never repeat what the card
|
|
821
|
-
shows.
|
|
846
|
+
quote money and counts exactly as given and never to add them up itself (a
|
|
847
|
+
model that adds up line items will eventually add them up wrong).
|
|
822
848
|
- **A card matches the panel, not the page.** The card sits in the agent's
|
|
823
849
|
panel - white by default (the agent's theme: `backgroundColor #FFFFFF`,
|
|
824
850
|
`primaryColor` for accents; a `darkTheme` when the panel is dark, and the
|
package/package.json
CHANGED
package/recipes/README.md
CHANGED
|
@@ -43,9 +43,10 @@ SDK's: `execute(params)` and
|
|
|
43
43
|
`render(data, host, header, callback, cancel, readyState)`
|
|
44
44
|
(<https://docs.foldspace.ai/guides/in-chat-ui/>), `foldspace.identify(context)`
|
|
45
45
|
(<https://docs.foldspace.ai/start/user-context/>), and the harness runtime.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
Never set `awaitUserInput` - the SDK waits when `render` uses `callback`,
|
|
47
|
+
`cancel` or `readyState` (see the card bullet below). What the agent receives
|
|
48
|
+
for each is in CLAUDE.md (**Agentic UI components**); no recipe uses
|
|
49
|
+
`readyState` yet.
|
|
49
50
|
|
|
50
51
|
Error handling is **not** taken from those builds. They predate `reason`: one
|
|
51
52
|
turns every failure into "unexpected error", another reports a missing session
|
|
@@ -8,7 +8,7 @@ This card is the base layout. Copy it, then replace the `/__observe_me` routes w
|
|
|
8
8
|
|
|
9
9
|
A view card: `render` takes no `callback` and the action sets no `awaitUserInput`. As soon as the card is drawn, the agent gets "Shown to the user. The user has not acted on it." plus exactly what `execute` returned - the account, the totals and every row behind the tabs, or the failure (`success: false`, `error` and `reason`) - and it answers questions about the account from that. So `execute` returns the overview the card draws and nothing else. One tab is on screen at a time; an empty tab says so. A signed-out or failed call is drawn with `renderFailure`, never as zeros. A 200 is signed out unless the account has both an id and a name.
|
|
10
10
|
|
|
11
|
-
In Agent Studio: an action with key `show_account_overview` and one string parameter `accountId`, described as "The account's id. Never taken from the user's words: get it from `<lookup action key>`." Replace `<lookup action key>` with the key of this agent's action that returns account ids; if the agent has none, build that action first - `find-by-name` has the shape. Its `instructions`: "
|
|
11
|
+
In Agent Studio: an action with key `show_account_overview` and one string parameter `accountId`, described as "The account's id. Never taken from the user's words: get it from `<lookup action key>`." Replace `<lookup action key>` with the key of this agent's action that returns account ids; if the agent has none, build that action first - `find-by-name` has the shape. Its `instructions`: "Quote money and counts exactly as given, and never add them up yourself. No emoji."
|
|
12
12
|
|
|
13
13
|
## Adapt it
|
|
14
14
|
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
13
|
"confirmation_required": false,
|
|
14
|
-
"instructions": "The result is the data the card was drawn from - every open deal, person and open case, not only the ones it lists - or a failure: success false, with the reason.
|
|
14
|
+
"instructions": "The result is the data the card was drawn from - every open deal, person and open case, not only the ones it lists - or a failure: success false, with the reason. Quote money and counts exactly as given, and never add them up yourself. No emoji."
|
|
15
15
|
}
|
|
@@ -8,7 +8,7 @@ The app decides what "at risk" means, on the server. In that build it was: stall
|
|
|
8
8
|
|
|
9
9
|
A view card: `render` takes no `callback` and the action sets no `awaitUserInput`. As soon as the card is drawn, the agent gets "Shown to the user. The user has not acted on it." plus exactly what `execute` returned - the count, the total, the average and the rows (no rows when the card says "No opportunities are at risk."), or the failure (`success: false`, `error` and `reason`). So `execute` returns what the card draws, with each row's id, and nothing else. The count, the total and the average are computed in code from the rows.
|
|
10
10
|
|
|
11
|
-
In Agent Studio: an action with key `show_opportunities_at_risk` and no parameters. Its `instructions`: "
|
|
11
|
+
In Agent Studio: an action with key `show_opportunities_at_risk` and no parameters. Its `instructions`: "Quote money and counts exactly as given, and never add them up yourself. No emoji."
|
|
12
12
|
|
|
13
13
|
## Adapt it
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ A view card: `render` takes no `callback` and the action sets no `awaitUserInput
|
|
|
8
8
|
|
|
9
9
|
`brand.ts` here is a placeholder: keep the `agent/views/brand.ts` that `npx foldspace observe styles --write` wrote - it has every key the recipe cards read. If the project has none yet, run that command first; do not copy this one.
|
|
10
10
|
|
|
11
|
-
In Agent Studio: an action with key `list_accounts` and no parameters. Its `instructions`: "
|
|
11
|
+
In Agent Studio: an action with key `list_accounts` and no parameters. Its `instructions`: "Quote money and counts exactly as given, and never add them up yourself. No emoji."
|
|
12
12
|
|
|
13
13
|
## Adapt it
|
|
14
14
|
|
package/src/lint/rules.mjs
CHANGED
|
@@ -586,7 +586,7 @@ export function ruleCardContract(sourceFile, relative, findings) {
|
|
|
586
586
|
node: flag.name,
|
|
587
587
|
file: relative,
|
|
588
588
|
message:
|
|
589
|
-
"A view card (render uses
|
|
589
|
+
"A view card (render uses none of callback, cancel or readyState) sets awaitUserInput: true. The chat panel ignores it, but in headless mode the agent then waits for a callback that never comes.",
|
|
590
590
|
fix: "Remove awaitUserInput. A view card is reported to the agent as shown, with what execute returned.",
|
|
591
591
|
}),
|
|
592
592
|
);
|
|
@@ -600,7 +600,7 @@ export function ruleCardContract(sourceFile, relative, findings) {
|
|
|
600
600
|
node: flag.name,
|
|
601
601
|
file: relative,
|
|
602
602
|
message:
|
|
603
|
-
"A view card does not need awaitUserInput: render uses
|
|
603
|
+
"A view card does not need awaitUserInput: render uses none of callback, cancel or readyState, so the agent is told the card was shown, with what execute returned.",
|
|
604
604
|
fix: "Remove awaitUserInput.",
|
|
605
605
|
}),
|
|
606
606
|
);
|