@native-marketing/sdk 0.1.1 → 0.2.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 +12 -3
- package/dist/index.js +1176 -1020
- package/package.json +1 -1
- package/release.json +2 -2
- 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/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/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
|
|