@siglume/api-sdk 0.10.8 → 1.1.0

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,99 +1,148 @@
1
- # @siglume/api-sdk
2
-
3
- TypeScript runtime for building, testing, and registering Siglume developer apps.
4
-
5
- This package is prepared in the public SDK repo and ships with the current v0.10.x release line.
6
-
7
- It also includes `draft_tool_manual()` and `fill_tool_manual_gaps()` with
8
- bundled `AnthropicProvider` and `OpenAIProvider` classes. Provide
9
- `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, then:
10
-
11
- ```ts
12
- import { AnthropicProvider, draft_tool_manual } from "@siglume/api-sdk";
13
-
14
- const result = await draft_tool_manual({
15
- capability_key: "currency-converter-jp",
16
- job_to_be_done: "Convert USD amounts to JPY with live rates",
17
- permission_class: "read_only",
18
- llm: new AnthropicProvider(),
19
- });
20
-
21
- console.log(result.quality_report.grade);
22
- ```
23
-
24
- Buyer-side discovery and export helpers are also included:
25
-
26
- ```ts
27
- import { SiglumeBuyerClient, to_anthropic_tool } from "@siglume/api-sdk";
28
-
29
- const buyer = new SiglumeBuyerClient({
30
- api_key: process.env.SIGLUME_API_KEY ?? "sig_mock_key",
31
- default_agent_id: process.env.SIGLUME_AGENT_ID,
32
- });
33
-
34
- const listing = await buyer.get_listing("currency-converter-v2");
35
- const anthropicTool = to_anthropic_tool(listing.tool_manual).schema;
36
- ```
37
-
38
- `SiglumeBuyerClient.invoke()` remains experimental and stays gated behind
39
- `allow_internal_execute: true` for privileged test environments until a public
40
- buyer execution route is available.
41
-
42
- See [`../docs/buyer-sdk.md`](../docs/buyer-sdk.md) and
43
- [`../examples/buyer_claude_agent_sdk.ts`](../examples/buyer_claude_agent_sdk.ts)
44
- for the current experimental limitations and the mocked integration example.
45
-
46
- You can also generate deterministic first-party owner-operation wrappers from
47
- the CLI without using an LLM:
48
-
49
- ```bash
50
- siglume init --list-operations
51
- siglume init --from-operation owner.charter.update ./my-charter-editor
52
- ```
53
-
54
- See [`../docs/template-generator.md`](../docs/template-generator.md) for the
55
- generated file layout, fallback behavior, and review samples.
56
-
57
- For API Store publishing, the recommended CLI flow is:
58
-
59
- ```bash
60
- siglume init --template price-compare
61
- siglume test .
62
- siglume score . --offline
63
-
64
- # Issue SIGLUME_API_KEY from Developer Portal -> CLI / API keys before production checks:
65
- siglume validate .
66
- siglume score . --remote
67
- siglume preflight . # checks blockers without creating a draft
68
- siglume register . # preflight + auto-register + confirm/publish
69
- siglume register . --draft-only # review-only draft staging
70
- siglume companies # list company publishers available to this key
71
- siglume register . --company company_123
72
- ```
73
-
74
- `siglume register` reads `tool_manual.json`, the local Git-ignored
75
- `runtime_validation.json`, and optional local Git-ignored
76
- `oauth_credentials.json`. Generated projects keep runtime validation and OAuth
77
- credential files Git-ignored because they can contain review keys and client
78
- secrets. SDK / HTTP automation can pass
79
- `source_url`, `source_context`, and `input_form_spec` directly to
80
- `auto-register`. The CLI runs preflight by default, then calls the same
81
- `auto-register` route used by SDK / automation clients and confirms publication
82
- unless `--draft-only` is set. Re-run the same `capability_key` to publish a
83
- non-material upgrade when checks pass. The server-side publish gate
84
- includes runtime checks, contract checks, seller OAuth checks, pricing / payout
85
- rules, and a mandatory fail-closed LLM legal review for law compliance plus
86
- public-order / morals compliance.
87
-
88
- Company-name publishing is founder-only in the Phase 2 MVP. Use
89
- `publisher_type: "company"` with `company_id` in `app_manifest.yaml`, or pass
90
- `--company <company_id>` to the CLI. Paid company listings require the
91
- company's verified settlement wallet; Siglume does not fall back to the
92
- registrant's personal payout wallet.
93
-
94
- Game APIs use the same publishing flow. To make a listing eligible for the
95
- dedicated Game API Store entry point, include explicit game-oriented
96
- `compatibility_tags` in the manifest, for example `["game", "unity",
97
- "realtime", "npc"]`. Use concrete tags such as `game`, `unity`, `unreal`,
98
- `godot`, `npc`, `matchmaking`, `multiplayer`, `realtime`, `ugc`, or
99
- `narrative`; do not send arbitrary registration `metadata` for store placement.
1
+ # @siglume/api-sdk
2
+
3
+ TypeScript runtime for building, testing, and registering Siglume developer apps.
4
+
5
+ This package is prepared in the public SDK repo and ships with the current v0.10.x release line.
6
+
7
+ It also includes `draft_tool_manual()` and `fill_tool_manual_gaps()` with
8
+ bundled `AnthropicProvider` and `OpenAIProvider` classes. Provide
9
+ `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, then:
10
+
11
+ ```ts
12
+ import { AnthropicProvider, draft_tool_manual } from "@siglume/api-sdk";
13
+
14
+ const result = await draft_tool_manual({
15
+ capability_key: "currency-converter-jp",
16
+ job_to_be_done: "Convert USD amounts to JPY with live rates",
17
+ permission_class: "read_only",
18
+ llm: new AnthropicProvider(),
19
+ });
20
+
21
+ console.log(result.quality_report.grade);
22
+ ```
23
+
24
+ Buyer-side discovery and export helpers are also included:
25
+
26
+ ```ts
27
+ import { SiglumeBuyerClient, to_anthropic_tool } from "@siglume/api-sdk";
28
+
29
+ const buyer = new SiglumeBuyerClient({
30
+ api_key: process.env.SIGLUME_API_KEY ?? "sig_mock_key",
31
+ default_agent_id: process.env.SIGLUME_AGENT_ID,
32
+ });
33
+
34
+ const listing = await buyer.get_listing("currency-converter-v2");
35
+ const anthropicTool = to_anthropic_tool(listing.tool_manual).schema;
36
+ ```
37
+
38
+ `SiglumeBuyerClient.invoke()` remains experimental and stays gated behind
39
+ `allow_internal_execute: true` for privileged test environments until a public
40
+ buyer execution route is available.
41
+
42
+ See [`../docs/buyer-sdk.md`](../docs/buyer-sdk.md) and
43
+ [`../examples/buyer_claude_agent_sdk.ts`](../examples/buyer_claude_agent_sdk.ts)
44
+ for the current experimental limitations and the mocked integration example.
45
+
46
+ You can also generate deterministic first-party owner-operation wrappers from
47
+ the CLI without using an LLM:
48
+
49
+ ```bash
50
+ siglume init --list-operations
51
+ siglume init --from-operation owner.charter.update ./my-charter-editor
52
+ ```
53
+
54
+ See [`../docs/template-generator.md`](../docs/template-generator.md) for the
55
+ generated file layout, fallback behavior, and review samples.
56
+
57
+ For API Store publishing, the recommended CLI flow is:
58
+
59
+ ```bash
60
+ siglume init --template price-compare
61
+ siglume test .
62
+ siglume score . --offline
63
+
64
+ # Issue SIGLUME_API_KEY from Developer Portal -> CLI / API keys before production checks:
65
+ siglume validate .
66
+ siglume score . --remote
67
+ siglume preflight . # checks blockers without creating a draft
68
+ siglume register . # preflight + auto-register + confirm/publish
69
+ siglume register . --draft-only # review-only draft staging
70
+ siglume companies # list company publishers available to this key
71
+ siglume register . --company company_123
72
+ ```
73
+
74
+ `siglume register` reads `tool_manual.json`, the local Git-ignored
75
+ `runtime_validation.json`. Generated projects keep runtime validation files
76
+ Git-ignored because they can contain review keys. SDK / HTTP automation can pass
77
+ `source_url`, `source_context`, and `input_form_spec` directly to
78
+ `auto-register`. The CLI runs preflight by default, then calls the same
79
+ `auto-register` route used by SDK / automation clients and confirms publication
80
+ unless `--draft-only` is set. Re-run the same `capability_key` to publish a
81
+ non-material upgrade when checks pass. The server-side publish gate
82
+ includes runtime checks, contract checks, external OAuth declaration checks, pricing / payout
83
+ rules, and a mandatory fail-closed LLM legal review for law compliance plus
84
+ public-order / morals compliance.
85
+
86
+ ## Usage-Based And Per-Action Billing
87
+
88
+ Use `price_model: PriceModel.USAGE_BASED` or `PriceModel.PER_ACTION` when the
89
+ API must execute before the final operation is known. These listings are free to
90
+ invoke up front. Your adapter returns the executed operation in
91
+ `ExecutionResult.receipt_summary`; the matching `pricing_plan` item sets the
92
+ charge:
93
+
94
+ ```ts
95
+ return {
96
+ success: true,
97
+ output: { posted: true, post_url: "https://x.com/..." },
98
+ units_consumed: 1,
99
+ amount_minor: 20,
100
+ currency: "JPY",
101
+ receipt_summary: {
102
+ operation: "url_post",
103
+ amount_minor: 20,
104
+ currency: "JPY",
105
+ },
106
+ };
107
+ ```
108
+
109
+ Set `price_value_minor: 0` when prices vary by operation, and publish a
110
+ buyer-facing `pricing_plan` so API Store and Game API Store can show the plan.
111
+ `pricing_plan.items` is required for `usage_based` and `per_action` listings:
112
+
113
+ ```ts
114
+ pricing_plan: {
115
+ display_name: "Operation prices",
116
+ currency: "JPY",
117
+ free_upfront_invocation: true,
118
+ items: [
119
+ { key: "connection_check", label: "Connection check", price_minor: 0 },
120
+ { key: "dry_run", label: "Dry-run preview", price_minor: 0 },
121
+ { key: "text_post", label: "Text post", price_minor: 15 },
122
+ { key: "url_post", label: "URL post", price_minor: 20 },
123
+ { key: "reply", label: "Reply", price_minor: 30 },
124
+ ],
125
+ }
126
+ ```
127
+
128
+ The `pricing_plan` is authoritative. If the adapter returns a conflicting
129
+ positive amount, the platform rejects the call instead of charging an arbitrary
130
+ API-declared amount. `0` is valid for free operations. For JPY/JPYC billing,
131
+ positive operation prices must be at least `15` minor units; `1` through `14`
132
+ are rejected by the SDK and platform because platform-sponsored gas can exceed
133
+ the fee.
134
+ `units_consumed` is kept for receipts and analytics; it does not multiply a
135
+ request-type plan price.
136
+
137
+ Company-name publishing is founder-only in the Phase 2 MVP. Use
138
+ `publisher_type: "company"` with `company_id` in `app_manifest.yaml`, or pass
139
+ `--company <company_id>` to the CLI. Paid company listings require the
140
+ company's verified settlement wallet; Siglume does not fall back to the
141
+ registrant's personal payout wallet.
142
+
143
+ Game APIs use the same publishing flow. To make a listing eligible for the
144
+ dedicated Game API Store entry point, include explicit game-oriented
145
+ `compatibility_tags` in the manifest, for example `["game", "unity",
146
+ "realtime", "npc"]`. Use concrete tags such as `game`, `unity`, `unreal`,
147
+ `godot`, `npc`, `matchmaking`, `multiplayer`, `realtime`, `ugc`, or
148
+ `narrative`; do not send arbitrary registration `metadata` for store placement.