@prismer/runtime 2.0.7 → 2.0.8
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/CHANGELOG.md +201 -0
- package/built-in-skills/agent-coordination/SKILL.md +235 -0
- package/built-in-skills/agent-meta/SKILL.md +52 -0
- package/built-in-skills/assets/SKILL.md +131 -0
- package/built-in-skills/canvas-design/LICENSE.txt +202 -0
- package/built-in-skills/canvas-design/SKILL.md +156 -0
- package/built-in-skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/built-in-skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/built-in-skills/claim-agent-ownership/SKILL.md +254 -0
- package/built-in-skills/claude-api/LICENSE.txt +202 -0
- package/built-in-skills/claude-api/SKILL.md +324 -0
- package/built-in-skills/claude-api/csharp/claude-api.md +402 -0
- package/built-in-skills/claude-api/curl/examples.md +216 -0
- package/built-in-skills/claude-api/curl/managed-agents.md +336 -0
- package/built-in-skills/claude-api/go/claude-api.md +421 -0
- package/built-in-skills/claude-api/go/managed-agents/README.md +561 -0
- package/built-in-skills/claude-api/java/claude-api.md +432 -0
- package/built-in-skills/claude-api/java/managed-agents/README.md +442 -0
- package/built-in-skills/claude-api/php/claude-api.md +375 -0
- package/built-in-skills/claude-api/php/managed-agents/README.md +435 -0
- package/built-in-skills/claude-api/python/claude-api/README.md +420 -0
- package/built-in-skills/claude-api/python/claude-api/batches.md +185 -0
- package/built-in-skills/claude-api/python/claude-api/files-api.md +165 -0
- package/built-in-skills/claude-api/python/claude-api/streaming.md +162 -0
- package/built-in-skills/claude-api/python/claude-api/tool-use.md +590 -0
- package/built-in-skills/claude-api/python/managed-agents/README.md +332 -0
- package/built-in-skills/claude-api/ruby/claude-api.md +113 -0
- package/built-in-skills/claude-api/ruby/managed-agents/README.md +389 -0
- package/built-in-skills/claude-api/shared/agent-design.md +101 -0
- package/built-in-skills/claude-api/shared/error-codes.md +213 -0
- package/built-in-skills/claude-api/shared/live-sources.md +135 -0
- package/built-in-skills/claude-api/shared/managed-agents-api-reference.md +378 -0
- package/built-in-skills/claude-api/shared/managed-agents-client-patterns.md +209 -0
- package/built-in-skills/claude-api/shared/managed-agents-core.md +238 -0
- package/built-in-skills/claude-api/shared/managed-agents-environments.md +215 -0
- package/built-in-skills/claude-api/shared/managed-agents-events.md +195 -0
- package/built-in-skills/claude-api/shared/managed-agents-memory.md +197 -0
- package/built-in-skills/claude-api/shared/managed-agents-multiagent.md +99 -0
- package/built-in-skills/claude-api/shared/managed-agents-onboarding.md +114 -0
- package/built-in-skills/claude-api/shared/managed-agents-outcomes.md +106 -0
- package/built-in-skills/claude-api/shared/managed-agents-overview.md +68 -0
- package/built-in-skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +173 -0
- package/built-in-skills/claude-api/shared/managed-agents-tools.md +321 -0
- package/built-in-skills/claude-api/shared/managed-agents-webhooks.md +110 -0
- package/built-in-skills/claude-api/shared/model-migration.md +779 -0
- package/built-in-skills/claude-api/shared/models.md +121 -0
- package/built-in-skills/claude-api/shared/prompt-caching.md +171 -0
- package/built-in-skills/claude-api/shared/tool-use-concepts.md +327 -0
- package/built-in-skills/claude-api/typescript/claude-api/README.md +333 -0
- package/built-in-skills/claude-api/typescript/claude-api/batches.md +106 -0
- package/built-in-skills/claude-api/typescript/claude-api/files-api.md +98 -0
- package/built-in-skills/claude-api/typescript/claude-api/streaming.md +178 -0
- package/built-in-skills/claude-api/typescript/claude-api/tool-use.md +527 -0
- package/built-in-skills/claude-api/typescript/managed-agents/README.md +359 -0
- package/built-in-skills/doc-coauthoring/SKILL.md +375 -0
- package/built-in-skills/frontend-design/LICENSE.txt +177 -0
- package/built-in-skills/frontend-design/SKILL.md +42 -0
- package/built-in-skills/human-approval/SKILL.md +114 -0
- package/built-in-skills/image-generate/SKILL.md +327 -0
- package/built-in-skills/ingest/SKILL.md +105 -0
- package/built-in-skills/internal-comms/LICENSE.txt +202 -0
- package/built-in-skills/internal-comms/SKILL.md +32 -0
- package/built-in-skills/internal-comms/examples/3p-updates.md +47 -0
- package/built-in-skills/internal-comms/examples/company-newsletter.md +65 -0
- package/built-in-skills/internal-comms/examples/faq-answers.md +30 -0
- package/built-in-skills/internal-comms/examples/general-comms.md +16 -0
- package/built-in-skills/liteparse/SKILL.md +156 -0
- package/built-in-skills/mcp-builder/LICENSE.txt +202 -0
- package/built-in-skills/mcp-builder/SKILL.md +236 -0
- package/built-in-skills/mcp-builder/reference/evaluation.md +602 -0
- package/built-in-skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/built-in-skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/built-in-skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/built-in-skills/mcp-builder/scripts/connections.py +151 -0
- package/built-in-skills/mcp-builder/scripts/evaluation.py +373 -0
- package/built-in-skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/built-in-skills/mcp-builder/scripts/requirements.txt +2 -0
- package/built-in-skills/memory/SKILL.md +106 -0
- package/built-in-skills/memory-curation/SKILL.md +135 -0
- package/built-in-skills/office-artifacts/SKILL.md +198 -0
- package/built-in-skills/prismer-im-collab/SKILL.md +148 -0
- package/built-in-skills/skill-authoring/SKILL.md +124 -0
- package/built-in-skills/skill-authoring/skill.json +74 -0
- package/built-in-skills/skill-creator/LICENSE.txt +202 -0
- package/built-in-skills/skill-creator/SKILL.md +485 -0
- package/built-in-skills/skill-creator/agents/analyzer.md +274 -0
- package/built-in-skills/skill-creator/agents/comparator.md +202 -0
- package/built-in-skills/skill-creator/agents/grader.md +223 -0
- package/built-in-skills/skill-creator/assets/eval_review.html +146 -0
- package/built-in-skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/built-in-skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/built-in-skills/skill-creator/references/schemas.md +430 -0
- package/built-in-skills/skill-creator/scripts/__init__.py +0 -0
- package/built-in-skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/built-in-skills/skill-creator/scripts/generate_report.py +326 -0
- package/built-in-skills/skill-creator/scripts/improve_description.py +247 -0
- package/built-in-skills/skill-creator/scripts/package_skill.py +136 -0
- package/built-in-skills/skill-creator/scripts/quick_validate.py +103 -0
- package/built-in-skills/skill-creator/scripts/run_eval.py +310 -0
- package/built-in-skills/skill-creator/scripts/run_loop.py +328 -0
- package/built-in-skills/skill-creator/scripts/utils.py +47 -0
- package/built-in-skills/slack-gif-creator/LICENSE.txt +202 -0
- package/built-in-skills/slack-gif-creator/SKILL.md +271 -0
- package/built-in-skills/slack-gif-creator/core/easing.py +234 -0
- package/built-in-skills/slack-gif-creator/core/frame_composer.py +176 -0
- package/built-in-skills/slack-gif-creator/core/gif_builder.py +269 -0
- package/built-in-skills/slack-gif-creator/core/validators.py +136 -0
- package/built-in-skills/slack-gif-creator/requirements.txt +4 -0
- package/built-in-skills/tasks/SKILL.md +398 -0
- package/built-in-skills/team/SKILL.md +76 -0
- package/built-in-skills/web-artifacts-builder/LICENSE.txt +202 -0
- package/built-in-skills/web-artifacts-builder/SKILL.md +104 -0
- package/built-in-skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/built-in-skills/web-artifacts-builder/scripts/init-artifact.sh +334 -0
- package/built-in-skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/built-in-skills/webapp-testing/LICENSE.txt +202 -0
- package/built-in-skills/webapp-testing/SKILL.md +96 -0
- package/built-in-skills/webapp-testing/examples/console_logging.py +35 -0
- package/built-in-skills/webapp-testing/examples/element_discovery.py +40 -0
- package/built-in-skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/built-in-skills/webapp-testing/scripts/with_server.py +106 -0
- package/dist/cli.cjs +6195 -1631
- package/dist/cli.js +6148 -1585
- package/dist/index.cjs +6032 -1468
- package/dist/index.d.cts +813 -43
- package/dist/index.d.ts +813 -43
- package/dist/index.js +6017 -1454
- package/package.json +4 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claim-agent-ownership
|
|
3
|
+
description: |
|
|
4
|
+
Orchestrator skill for resolving multi-daemon binding contention. Use when you (the
|
|
5
|
+
orchestrator) detect an `agent.binding.contested` sync event indicating two daemons
|
|
6
|
+
are racing for the same agent — explicitly rebind ownership to a chosen target daemon
|
|
7
|
+
so subsequent dispatches route deterministically. Implements Gap G-2-⑤ on top of the
|
|
8
|
+
Wave 2-B2 `/api/im/agent-bindings/:agentImUserId/rebind` endpoint.
|
|
9
|
+
applies_to: [hermes, claude-code, openclaw, codex]
|
|
10
|
+
requires:
|
|
11
|
+
- aip-identity
|
|
12
|
+
phaseModel:
|
|
13
|
+
defaultPhase: tool_use
|
|
14
|
+
version: 1
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Claim Agent Ownership
|
|
18
|
+
|
|
19
|
+
When two daemons (typically Mac Studio at home + a k8s pod) both run `agent.host.declare`
|
|
20
|
+
for the same agent, the first one wins ownership and the second registers a
|
|
21
|
+
**contested** binding. The user UI surfaces a "binding contested" badge and the cloud's
|
|
22
|
+
`resolveAgentDaemonRoute` keeps routing dispatches to the original owner — but a
|
|
23
|
+
human-driven or orchestrator-driven decision is needed to converge.
|
|
24
|
+
|
|
25
|
+
This skill is the **orchestrator's tool for that decision**. It calls the server's
|
|
26
|
+
authoritative rebind endpoint, which atomically:
|
|
27
|
+
|
|
28
|
+
1. flips `im_agent_bindings.boundDaemonId` to the chosen target daemon
|
|
29
|
+
2. writes an audit row with `boundBy='user-explicit'` (or `'orchestrator'`)
|
|
30
|
+
3. returns the **in-flight task count** on the previous owner so the orchestrator can
|
|
31
|
+
wait / drain before redirecting traffic
|
|
32
|
+
4. emits a sync event (`agent.binding.rebound`) so other daemons drop their hosting
|
|
33
|
+
state for the agent
|
|
34
|
+
|
|
35
|
+
## When to use
|
|
36
|
+
|
|
37
|
+
- A sync event with type `agent.binding.contested` arrives in your inbox.
|
|
38
|
+
- A user explicitly asks "the agent is bouncing between machines — pin it to my laptop".
|
|
39
|
+
- You (orchestrator) decide to migrate an agent off a misbehaving daemon (high error
|
|
40
|
+
rate, stale heartbeats, etc.) and a target is available.
|
|
41
|
+
- Devices panel shows >1 daemon claiming the same agent and the user requests
|
|
42
|
+
arbitration.
|
|
43
|
+
|
|
44
|
+
**Do not** use it for:
|
|
45
|
+
|
|
46
|
+
- Healthy single-daemon bindings (no contention — nothing to claim).
|
|
47
|
+
- Agents the orchestrator does not own / has no permission for (server rejects 403).
|
|
48
|
+
- Routing decisions that should be reversible at the chat-message level (use
|
|
49
|
+
`metadata.daemonId` overrides in single dispatches instead).
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
There is **no generic `cloud im get` / `cloud im post`** subcommand in the
|
|
54
|
+
runtime CLI today (release 201 audit, `sdk/prismer-cloud/runtime/src/cli/`).
|
|
55
|
+
A dedicated `cloud agent rebind` verb is not landed either. The skill calls
|
|
56
|
+
the cloud HTTP endpoint directly via `curl` (or the equivalent fetch from the
|
|
57
|
+
orchestrator's MCP runtime), authenticating with the daemon API key already
|
|
58
|
+
present in the environment as `$PRISMER_API_KEY`:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Inspect the current bindings first.
|
|
62
|
+
curl -fsS \
|
|
63
|
+
-H "Authorization: Bearer $PRISMER_API_KEY" \
|
|
64
|
+
"$PRISMER_CLOUD_BASE/api/im/workspaces/<workspaceId>/agent-bindings"
|
|
65
|
+
|
|
66
|
+
# Issue the rebind. Requires workspace owner / active orchestrator / admin.
|
|
67
|
+
curl -fsS \
|
|
68
|
+
-X POST \
|
|
69
|
+
-H "Authorization: Bearer $PRISMER_API_KEY" \
|
|
70
|
+
-H "Content-Type: application/json" \
|
|
71
|
+
-d '{"targetDaemonId":"<daemonId>","targetDaemonKind":"local","reason":"<short reason>"}' \
|
|
72
|
+
"$PRISMER_CLOUD_BASE/api/im/agent-bindings/<agentImUserId>/rebind"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`PRISMER_CLOUD_BASE` defaults to the cloud the daemon paired with
|
|
76
|
+
(`https://prismer.cloud` in prod, `http://127.0.0.1:3000` in local dev).
|
|
77
|
+
|
|
78
|
+
For pure-API use (orchestrator runtime, MCP tool, etc.), the underlying call is:
|
|
79
|
+
|
|
80
|
+
```http
|
|
81
|
+
POST /api/im/agent-bindings/:agentImUserId/rebind
|
|
82
|
+
Authorization: Bearer <daemon api key>
|
|
83
|
+
Content-Type: application/json
|
|
84
|
+
|
|
85
|
+
{
|
|
86
|
+
"targetDaemonId": "daemon-mac-studio-01", // required, must exist in workspace
|
|
87
|
+
"targetDaemonKind": "local", // optional: 'k8s' | 'local' | 'edge'
|
|
88
|
+
"targetDaemonLabel": "Mac Studio (home)", // optional display label
|
|
89
|
+
"reason": "user prefers desktop daemon while on home network"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Successful response:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"ok": true,
|
|
98
|
+
"data": {
|
|
99
|
+
"binding": {
|
|
100
|
+
"agentImUserId": "u_agent_ceo",
|
|
101
|
+
"boundDaemonId": "daemon-mac-studio-01",
|
|
102
|
+
"boundDaemonKind": "local",
|
|
103
|
+
"boundDaemonLabel": "Mac Studio (home)",
|
|
104
|
+
"boundBy": "user-explicit",
|
|
105
|
+
"boundAt": "2026-05-22T16:30:00.000Z"
|
|
106
|
+
},
|
|
107
|
+
"inFlightTaskCount": 3,
|
|
108
|
+
"previousDaemonId": "daemon-k8s-pod-7f4"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Failure modes worth handling explicitly:
|
|
114
|
+
|
|
115
|
+
| Status | Code (in body) | Meaning |
|
|
116
|
+
| --------------------- | ------------------------------- | -------------------------------------------------------------------- |
|
|
117
|
+
| `400` | `target daemon ... not registered` | Target daemonId not in `im_containers` for this workspace. |
|
|
118
|
+
| `400` / missing field | `targetDaemonId is required` | Body parse / missing required field — surface as developer error. |
|
|
119
|
+
| `403` | `Forbidden` | Caller is not workspace owner / orchestrator / admin. |
|
|
120
|
+
| `404` | `Agent not found ...` | Agent has no `im_agent_cards` row (deleted? wrong id?). |
|
|
121
|
+
| `404` | `No binding row exists ...` | Agent never ran host.declare. Tell the daemon to declare first. |
|
|
122
|
+
| `409` | `target daemon ... is stopped` | Target container has `stoppedAt` set — pick a different target. |
|
|
123
|
+
|
|
124
|
+
## Workflow
|
|
125
|
+
|
|
126
|
+
1. **Subscribe to `agent.binding.contested` sync events.** The orchestrator's sync inbox
|
|
127
|
+
delivers these out of band; the skill consumes them.
|
|
128
|
+
2. **Resolve the target daemon.** Read the binding list and pick the daemon you want to
|
|
129
|
+
keep — usually the one with:
|
|
130
|
+
- smaller `lastDispatchAt` skew (fresher),
|
|
131
|
+
- matching device kind to user preference (local vs k8s),
|
|
132
|
+
- lower `contestCount` (less flapping).
|
|
133
|
+
3. **Decide whether to drain.** If `inFlightTaskCount > 0` on the previous owner,
|
|
134
|
+
surface this to the user ("3 tasks finishing on the old daemon before switching").
|
|
135
|
+
The orchestrator should usually let those finish — the rebind takes effect for
|
|
136
|
+
subsequent dispatches, in-flight tasks complete via the existing route.
|
|
137
|
+
4. **Call rebind.** Pass `targetDaemonId` + `reason`. Optional kind/label improve UI
|
|
138
|
+
readability.
|
|
139
|
+
5. **Verify.** Read `/workspaces/:wsId/agent-bindings` again and confirm `boundDaemonId`
|
|
140
|
+
matches your target. If still divergent, the daemon may have re-declared between
|
|
141
|
+
read and write — repeat once.
|
|
142
|
+
|
|
143
|
+
## Operating Rules
|
|
144
|
+
|
|
145
|
+
- **Never rebind to a daemon you cannot see in the workspace listing.** The server
|
|
146
|
+
validates via `im_containers` — calling with a fictional id returns 400. Don't guess.
|
|
147
|
+
- **Always supply a reason.** It's persisted in the audit trail and surfaces in the
|
|
148
|
+
Devices panel ("rebound by orchestrator at HH:MM: <reason>"). Empty reason becomes
|
|
149
|
+
the default `'unspecified'` which is opaque to the user.
|
|
150
|
+
- **One rebind per binding per minute (orchestrator self-limit).** The endpoint is
|
|
151
|
+
not throttled, but flapping rebinds spam sync events and confuse the user. If the
|
|
152
|
+
contest re-fires within 60s of a rebind, escalate to the human — don't auto-rebind
|
|
153
|
+
again.
|
|
154
|
+
- **Wait for the dispatch in-flight count to drain before declaring "done"** if the
|
|
155
|
+
user is observing. The cloud routes new dispatches immediately, but the prior
|
|
156
|
+
daemon's outstanding tasks still finish on it.
|
|
157
|
+
|
|
158
|
+
## Output reporting
|
|
159
|
+
|
|
160
|
+
After successfully calling rebind:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
[claim-agent-ownership] rebound agent=<agentImUserId> from=<previousDaemonId>
|
|
164
|
+
to=<targetDaemonId> in-flight-on-previous=<n>
|
|
165
|
+
reason="<reason>"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Then surface to the user as a chat message: who you rebound, where to, why, and how
|
|
169
|
+
many tasks are still finishing on the old daemon (if any).
|
|
170
|
+
|
|
171
|
+
After a 4xx/5xx failure: report the HTTP status + the server's error code + message
|
|
172
|
+
verbatim. Do not silently retry on 400/403/404 — those need human attention.
|
|
173
|
+
|
|
174
|
+
## Backing capabilities
|
|
175
|
+
|
|
176
|
+
- **Server endpoint:** `POST /api/im/agent-bindings/:agentImUserId/rebind`
|
|
177
|
+
(Wave 2-B2, `src/im/api/agent-bindings.ts`)
|
|
178
|
+
- **Data model:** `IMAgentBinding` (migration 410, fields:
|
|
179
|
+
`boundDaemonId`, `boundDaemonKind`, `boundDaemonLabel`, `boundBy`, `contestCount`,
|
|
180
|
+
`contestedSince`)
|
|
181
|
+
- **Sync event consumed:** `agent.binding.contested` — emitted by `AgentBindingService`
|
|
182
|
+
when a second daemon declares an agent already bound to a different daemon.
|
|
183
|
+
- **Sync event emitted (server-side):** `agent.binding.rebound` — broadcast after
|
|
184
|
+
successful rebind so all daemons + UI consumers drop stale routing state.
|
|
185
|
+
- **Audit trail:** Each rebind writes an `IMTaskLog`-style entry with
|
|
186
|
+
`boundBy='user-explicit'` / `'orchestrator'` and the supplied reason; visible in the
|
|
187
|
+
Devices panel.
|
|
188
|
+
|
|
189
|
+
## Examples
|
|
190
|
+
|
|
191
|
+
### Example 1 — Orchestrator handling a contest event
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
Inbox event: { type: 'agent.binding.contested', agentImUserId: 'u_agent_ceo',
|
|
195
|
+
existingDaemonId: 'daemon-k8s-pod-7f4',
|
|
196
|
+
contendingDaemonId: 'daemon-mac-studio-01' }
|
|
197
|
+
|
|
198
|
+
Orchestrator inspects bindings:
|
|
199
|
+
curl -H "Authorization: Bearer $PRISMER_API_KEY" \
|
|
200
|
+
"$PRISMER_CLOUD_BASE/api/im/workspaces/ws_abc/agent-bindings"
|
|
201
|
+
|
|
202
|
+
Decision: user is on home network, prefer Mac Studio (local).
|
|
203
|
+
|
|
204
|
+
Action:
|
|
205
|
+
curl -X POST -H "Authorization: Bearer $PRISMER_API_KEY" \
|
|
206
|
+
-H "Content-Type: application/json" \
|
|
207
|
+
-d '{"targetDaemonId":"daemon-mac-studio-01","targetDaemonKind":"local",
|
|
208
|
+
"reason":"user on home network, preferring local daemon"}' \
|
|
209
|
+
"$PRISMER_CLOUD_BASE/api/im/agent-bindings/u_agent_ceo/rebind"
|
|
210
|
+
|
|
211
|
+
Response: boundDaemonId='daemon-mac-studio-01', inFlightTaskCount=2
|
|
212
|
+
Orchestrator messages user: "Pinned CEO agent to your Mac Studio. 2 tasks finishing on
|
|
213
|
+
the cloud pod first."
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Example 2 — User explicit "pin agent X to laptop"
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
User: "Make sure DesignAgent always runs on my laptop, not the k8s pod."
|
|
220
|
+
|
|
221
|
+
Orchestrator (after reading bindings):
|
|
222
|
+
curl -X POST -H "Authorization: Bearer $PRISMER_API_KEY" \
|
|
223
|
+
-H "Content-Type: application/json" \
|
|
224
|
+
-d '{"targetDaemonId":"daemon-laptop-9a","targetDaemonKind":"local",
|
|
225
|
+
"reason":"user-explicit: pin to laptop"}' \
|
|
226
|
+
"$PRISMER_CLOUD_BASE/api/im/agent-bindings/u_design_agent/rebind"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Example 3 — Failure to handle gracefully
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
Orchestrator tries to rebind to a daemon that just went offline:
|
|
233
|
+
POST .../rebind { targetDaemonId: "daemon-k8s-pod-7f4", ... }
|
|
234
|
+
← 409 { error: "target daemon daemon-k8s-pod-7f4 is stopped" }
|
|
235
|
+
|
|
236
|
+
Orchestrator should:
|
|
237
|
+
1. Re-read /workspaces/<wsId>/agent-bindings to find a live alternative.
|
|
238
|
+
2. If only one daemon remains and it's already the current owner, do nothing.
|
|
239
|
+
3. Otherwise retry with the live candidate.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Anti-patterns
|
|
243
|
+
|
|
244
|
+
- ❌ Calling rebind on every contested event without thinking — flap creates user
|
|
245
|
+
confusion. Wait until the user signals preference or a clear health signal arrives.
|
|
246
|
+
- ❌ Supplying `targetDaemonKind` / `targetDaemonLabel` that contradict the server's
|
|
247
|
+
inference (e.g. claiming `kind=k8s` for a `deviceType=local` container). The server
|
|
248
|
+
trusts the body so misuse leads to a wrong-shaped UI badge.
|
|
249
|
+
- ❌ Treating `inFlightTaskCount > 0` as a hard error — it's informational. The cloud
|
|
250
|
+
has already redirected new dispatches; existing in-flight work simply finishes on
|
|
251
|
+
the old route.
|
|
252
|
+
- ❌ Re-binding while another orchestrator is also working on the same workspace
|
|
253
|
+
without coordination. Use the workspace's orchestrator lease (`orchestratorAgentId`)
|
|
254
|
+
to make sure you're the active arbiter before mutating bindings.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Anthropic, PBC.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|