@tangle-network/chatgpt-agents-kit 0.1.0 → 0.1.1

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/CARDS.md ADDED
@@ -0,0 +1,118 @@
1
+ # Optional agent cards
2
+
3
+ Cards let people open an existing agent, submit a prompt, check the same task, and read its retained result.
4
+ They use the kit’s existing tools and OAuth scopes.
5
+ No browser token, task store, native client, or extra backend is introduced.
6
+
7
+ The cards entry is additive and unpublished until the next authorized kit release.
8
+ For local adoption, build and install this checkout’s npm tarball.
9
+
10
+ ```ts
11
+ import { createAgentsHandler } from '@tangle-network/chatgpt-agents-kit'
12
+ import { createAgentCards } from '@tangle-network/chatgpt-agents-kit/cards'
13
+
14
+ const handler = createAgentsHandler({
15
+ metadata,
16
+ oauth,
17
+ nativeMcp: createMcpToolHandler,
18
+ bind,
19
+ cards: createAgentCards({ domain: 'https://your-dedicated-widget-origin.example' }),
20
+ })
21
+ ```
22
+
23
+ Use your actual dedicated HTTPS widget origin for a hosted ChatGPT submission.
24
+ Omit `domain` for local compatible-host development.
25
+ Omit `cards` to retain the existing tools-only protocol.
26
+ The main package entry does not import React, UI components, or the embedded HTML.
27
+ The optional entry bundles all JavaScript and CSS; the widget makes no direct network requests.
28
+
29
+ ## Contract
30
+
31
+ The existing `list_my_agents`, `connect_my_agent`, `prompt_agent`, and `get_task` tools receive `_meta.ui.resourceUri` when cards are enabled.
32
+ The same authenticated handler serves `resources/list` and `resources/read` with `text/html;profile=mcp-app`.
33
+ Resource CSP declares no network or external asset domains.
34
+ Text and structured tool results remain available to clients that do not render UI.
35
+ Native actions, OAuth, scope checks, and workspace authorization run through the existing dispatcher.
36
+
37
+ The widget uses the official MCP Apps `App` bridge, with host theme and resize support.
38
+ It reuses Tangle Brand tokens and the maintained Tangle UI Button, Input, and Textarea components.
39
+ Only tools granted in the current native binding are offered as actions.
40
+ A read-only grant does not expose a prompt form, even when the model can discover a consent-upgrade tool.
41
+ Hosts without tool-call support display results and direct users back to chat.
42
+
43
+ Current GTM discovery returns workspace IDs without conversation IDs.
44
+ For those rows, cards require an existing conversation ID supplied by the user.
45
+ They do not invent a thread, create a conversation, or expose unsupported thread discovery.
46
+ Opening a card from a known `connect_my_agent` or `get_task` result skips that input.
47
+
48
+ Submission requires an explicit click and includes the connected agent’s native `contextVersion` and a fresh `turnId`.
49
+ A lost response offers a read of that same task; it never automatically resubmits.
50
+ A failed recovery read retains that original task identity.
51
+ When ChatGPT supports widget state, the card saves only the app/account identity, native target, task ID, and phase before admission.
52
+ After iframe recreation it checks the current authenticated identity and rereads the native task.
53
+ A restored card ignores host-replayed results; it renders only the fresh authorized native read.
54
+ A different account cannot use the saved handle; an unverified task remains unavailable until its native read succeeds.
55
+ The card also consumes complete host tool input when the host initiated a prompt call.
56
+ Widget state holds no prompt, output, token, or authoritative task data and is not cross-session storage.
57
+ An explicit task lookup failure keeps an editable task ID and a route back to the agent list.
58
+ Kit validation and context checks mark pre-admission rejection with `error.admission: not-started`; cards then offer reconnect and preserve the prompt draft.
59
+ Refresh always reads the original workspace, conversation, and task.
60
+ When supported, the widget updates model context for task, directory, agent, loading, and failure transitions.
61
+ The context describes the current selection and retained identity without output text.
62
+ It never sends output text as instructions or starts a follow-up model turn.
63
+
64
+ The UI displays native states without fabricated percentages.
65
+ “Completed” requires `completionVerified: true` from the kit.
66
+ Unverified outputs stay unavailable, and failed refreshes clear previously displayed results.
67
+ Results render as text, retaining whitespace, file revision, and SHA-256 evidence.
68
+ Cancellation, approval, provisioning, and messaging remain in the existing conversational tools; cards add no automatic actions.
69
+
70
+ ## Installed example and verification
71
+
72
+ From the repository root:
73
+
74
+ ```sh
75
+ npm ci --no-audit --no-fund
76
+ npm run build --workspace @tangle-network/chatgpt-agents-kit
77
+ npm run test:cards --workspace @tangle-network/chatgpt-agents-kit
78
+ npx playwright install chromium
79
+ npm run proof:cards --workspace @tangle-network/chatgpt-agents-kit
80
+ npm run proof:cards:lifecycle --workspace @tangle-network/chatgpt-agents-kit
81
+ ```
82
+
83
+ The browser proof packs the compiled kit and installs it outside the checkout.
84
+ A consumer module imports the public package and `./cards` entry through ordinary Node resolution.
85
+ Both GTM and Workspace configurations use that same installed renderer and the maintained Agent App MCP dispatcher.
86
+ Their distinct workspace, thread, turn, and execution IDs are checked against the existing deterministic SQLite test host.
87
+ The same task is refreshed and reopened without another admission.
88
+ The lifecycle proof recreates the iframe after an accepted admission with a lost response.
89
+ It checks the same task UUID, one native admission, renewed-account recovery, different-account denial, context changes, and partial theme updates.
90
+ The installed package test imports both the root and `/cards` exports with install scripts disabled.
91
+
92
+ The proof captures matching tool-only and rendered desktop/mobile images, light/dark themes, original interaction videos, keyboard use, and accessibility checks.
93
+ It also checks an empty list, a read-only grant, changed output revisions, and revoked access after a successful result.
94
+ Artifacts are written under `plugins/agents/receipts/cards/` and excluded from the published package.
95
+
96
+ To keep the example running for manual inspection:
97
+
98
+ ```sh
99
+ CARDS_PORT=4399 node plugins/agents/cards/example.mjs
100
+ ```
101
+
102
+ Open the printed GTM and Workspace URLs.
103
+ The example uses deterministic test data and test credentials confined to the local server.
104
+ It does not connect to a hosted Tangle account or execute a model.
105
+ Do not deploy this test host.
106
+
107
+ Hosted OAuth, live native execution, and an actual ChatGPT installation remain separate acceptance steps owned by each adopting application.
108
+ Install the released kit, enable cards on its existing authenticated endpoint, refresh tool discovery in ChatGPT, and repeat the same native identity/result checks.
109
+ The local example is not evidence that those hosted steps passed.
110
+
111
+ ## Maintained contracts consulted
112
+
113
+ - [OpenAI: Add UI to your MCP server](https://developers.openai.com/plugins/build/chatgpt-ui)
114
+ - [OpenAI: Plugin UI reference](https://developers.openai.com/plugins/reference)
115
+
116
+ Checked October 2, 2026.
117
+ OpenAI recommends separate rendering tools when repeated iframe refreshes hurt a workflow.
118
+ These compact cards attach to the existing tools to avoid duplicate public operations; their authenticated native results already contain the required data.
package/README.md CHANGED
@@ -414,3 +414,9 @@ Root foundation owns the repository marketplace, lockfile and shared tooling.
414
414
  Official specifications reviewed on 2026-09-30:
415
415
  - https://developers.openai.com/plugins/build/plugins
416
416
  - https://developers.openai.com/plugins/build/auth
417
+
418
+ ## Optional agent cards
419
+
420
+ Enable the separate `@tangle-network/chatgpt-agents-kit/cards` entry to render agents and verified task results through MCP Apps.
421
+ See [CARDS.md](./CARDS.md) for setup, installed examples, and the hosted acceptance boundary.
422
+ Omitting the option preserves tools-only clients.
@@ -0,0 +1,6 @@
1
+ import type { AgentCardsResource } from '../src/cards.ts';
2
+ /** Bundled at release build time; compatible with Workers and Node, without filesystem access. */
3
+ export declare function createAgentCards(options?: {
4
+ domain?: string;
5
+ }): AgentCardsResource;
6
+ export type { AgentCardsResource } from '../src/cards.ts';