@native-marketing/sdk 0.2.0 → 0.3.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/README.md DELETED
@@ -1,49 +0,0 @@
1
- # @native-marketing/sdk
2
-
3
- Node.js 24 authenticated clients for Native Marketing. No database access, server installation, planner or Runtime.
4
-
5
- ```sh
6
- npm install @native-marketing/sdk
7
- ```
8
-
9
- ```ts
10
- import { withNativeAgentClient, NativeAgentClientError } from '@native-marketing/sdk';
11
-
12
- const resource = process.env.CF_AGENT_RESOURCE;
13
- const accessToken = process.env.CF_AGENT_ACCESS_TOKEN;
14
- if (!resource || !accessToken) throw new Error('Configure resource-bound OAuth credentials');
15
-
16
- await withNativeAgentClient({ resource, accessToken }, async (native) => {
17
- const page = await native.discoverCapabilities({ query: '检查连接状态和当前项目' });
18
- const item = page.items[0];
19
- if (!item) return; // NO_MATCH applies to the currently authorized catalogue.
20
- const exact = await native.describeCapability(item.name, item.schemaSha256);
21
- const context = await native.readCapability({
22
- name: item.name,
23
- expectedSchemaSha256: exact.schemaSha256,
24
- arguments: {},
25
- delivery: 'ORIGINAL',
26
- });
27
- console.log(context);
28
- });
29
- ```
30
-
31
- The server filters discovery using current object, OAuth scopes and business permissions. `discoverCapabilities` uses AGENT_V3 bilingual action/object matching and explicit scoped NO_MATCH. Small results include the exact schema and fingerprint; `describeCapability(name, observedHash)` reuses a verified, bounded connection-local cache or loads the definition on demand. Every execution still checks current authorization and the fingerprint. The existing `findCapabilities` retains its v2 response contract. Search saved business content with `searchBusiness`; use `getBusinessSummary` for a bounded summary and nextActions. Ordinary collaboration and explicitly assigned execution remain separate.
32
-
33
- Writes retain exact schema fingerprints, request IDs, human decisions and optimistic concurrency. On `NativeAgentClientError` inspect `code`, `outcome` and `details`. An UNKNOWN outcome is not a rollback: follow the returned original receipt lookup using the same resource and current authorization. Never automatically retry writes, replace the request ID or infer success from the latest document. Refresh current business content separately after recovering the original result.
34
-
35
- Credentials belong in a protected credential store, never model prompts or arguments. This package does not acquire or widen permissions on import. Node.js 24 is required by the MCP client.
36
-
37
- ## HTTP client
38
-
39
- ```ts
40
- import { createContentFactoryClient } from '@native-marketing/sdk/http';
41
-
42
- const native = createContentFactoryClient({ baseUrl: 'https://ip.shipkitx.com/api/v1' });
43
- // A browser uses its existing authorized session. Node callers must provide an
44
- // authenticated fetch implementation; a base URL alone does not authenticate.
45
- ```
46
-
47
- The `/http` entry contains the existing typed HTTP client, validators and generated endpoint types; it does not import the Node MCP/CLI implementation. It does not retry writes or manage browser sessions for Node callers.
48
-
49
- The package's `release.json` records the actual source commit and generated API-types hash. This is a local build receipt, not CI provenance or proof that every remote business journey has been accepted. Rights reserved; public package availability does not grant an open-source license (UNLICENSED).