@native-marketing/sdk 0.1.1 → 0.3.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 +30 -3
- package/dist/index.js +1387 -1025
- package/package.json +1 -1
- package/release.json +3 -3
- package/types/contracts/agent/capabilities.d.ts +59 -0
- package/types/contracts/agent/index.d.ts +4 -0
- package/types/contracts/agent/input-repair.d.ts +32 -0
- package/types/contracts/agent/knowledge-reads.d.ts +1 -1
- package/types/contracts/agent/publication-preflight.d.ts +6 -0
- package/types/contracts/agent/test-records.d.ts +28 -0
- package/types/contracts/agent/validation.d.ts +7 -0
- package/types/contracts/event-backlog.d.ts +47 -0
- package/types/contracts/event-delivery.d.ts +124 -0
- package/types/contracts/event-exchange-browser.d.ts +39 -0
- package/types/contracts/event-exchange.d.ts +110 -0
- package/types/contracts/index.d.ts +7 -0
- package/types/contracts/knowledge-discovery.d.ts +185 -0
- package/types/contracts/knowledge-rich-document.d.ts +238 -1
- package/types/contracts/marketing-domain-events.d.ts +425 -0
- package/types/contracts/native-event-data.d.ts +8 -0
- package/types/contracts/provider-settings.d.ts +3 -0
- package/types/http/generated/schema.d.ts +2132 -1046
- package/types/sdk/agent-capabilities.d.ts +3 -0
- package/types/sdk/capability-definition.d.ts +24 -0
- package/types/sdk/client.d.ts +3 -2
- package/types/sdk/index.d.ts +2 -1
package/README.md
CHANGED
|
@@ -14,12 +14,21 @@ const accessToken = process.env.CF_AGENT_ACCESS_TOKEN;
|
|
|
14
14
|
if (!resource || !accessToken) throw new Error('Configure resource-bound OAuth credentials');
|
|
15
15
|
|
|
16
16
|
await withNativeAgentClient({ resource, accessToken }, async (native) => {
|
|
17
|
-
const page = await native.
|
|
18
|
-
|
|
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);
|
|
19
28
|
});
|
|
20
29
|
```
|
|
21
30
|
|
|
22
|
-
The server filters discovery using current object, OAuth scopes and business permissions.
|
|
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.
|
|
23
32
|
|
|
24
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.
|
|
25
34
|
|
|
@@ -37,4 +46,22 @@ const native = createContentFactoryClient({ baseUrl: 'https://ip.shipkitx.com/ap
|
|
|
37
46
|
|
|
38
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.
|
|
39
48
|
|
|
49
|
+
## Tenant application connections and event permissions
|
|
50
|
+
|
|
51
|
+
Use the exact authorized `/mcp/tenants/TEN-*` resource with `cf.context.read`, `cf.knowledge.manage` and the current Tenant's `permissions.manage` permission. Project resources cannot administer Tenant event connections.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
await withNativeAgentClient({ resource, accessToken }, async (native) => {
|
|
55
|
+
const connections = await native.callTool('cf_list_event_exchanges', { limit: 20 });
|
|
56
|
+
const schema = await native.describeCapability('cf_configure_event_exchange');
|
|
57
|
+
console.log(connections.result, schema.definition);
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`cf_configure_event_exchange` registers or revokes one exact EventSDK event-type Grant with the original `requestId` and current Connection `expectedRevision`. Inspect the current schema and confirm the precise source/target Tenant refs, consumer, event type and grant version before writing; events are never selected or authorized automatically. Other event types remain unchanged. Local ACTIVE does not grant peer consent, Broker access or resource readability.
|
|
62
|
+
|
|
63
|
+
Recover an unknown configure result using `cf_get_event_exchange_receipt` with the original requestId. `cf_list_event_outbox` reads one bounded page and backlog/Worker observation. An explicitly authorized `cf_recover_event_outbox` command preserves the original delivery identity and expectedGeneration; UNKNOWN uses `cf_get_event_outbox_recovery_receipt`, without replaying the command. Read each receipt under the same authorized resource/client. Receipt absence does not permit another write. Authorization management does not emit a new authorization-change CloudEvent.
|
|
64
|
+
|
|
65
|
+
The HTTP subpath includes typed GET/POST `/tenants/{tenantCode}/event-exchanges`, receipt and Outbox endpoints. HTTP uses the existing authorized Session; MCP uses resource-bound OAuth. Tenant and authorization facts remain in Native Marketing's database.
|
|
66
|
+
|
|
40
67
|
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).
|