@native-marketing/sdk 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,11 +1,21 @@
1
1
  {
2
2
  "name": "@native-marketing/sdk",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
7
7
  "node": ">=24 <25"
8
8
  },
9
+ "nativeMarketing": {
10
+ "contractVersion": 1,
11
+ "apiMajor": 1,
12
+ "nodeMajor": 24,
13
+ "changes": [
14
+ "Unified SDK, CLI and MCP release discovery and compatibility checks.",
15
+ "Configurable CLI update notifications, pins and compatible automatic updates.",
16
+ "Upgrade verification and explicit continuation without replaying business commands."
17
+ ]
18
+ },
9
19
  "publishConfig": {
10
20
  "access": "public",
11
21
  "registry": "https://registry.npmjs.org/"
package/release.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "sourceCommit": "667f36fbe201292e233c4be3cc8ba84483867fd9",
2
+ "sourceCommit": "170f43ed793abd2cee15faaba49428aa43c276cd",
3
3
  "workingTreeDirty": false,
4
- "version": "0.3.5",
5
- "openapiTypesSha256": "4cf54da717c27d1df685ee4756f78c5094e90fe72c3d3047e7b901b7e8b6c1b8",
4
+ "version": "0.3.7",
5
+ "openapiTypesSha256": "e79e0abf034cae01174e67464aea55f16d40895c86199eff93897ec892ea82f4",
6
6
  "localBuild": true
7
7
  }
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ export { nativeClientRelease } from './generated/client-release.js';
3
+ export declare const nativeReleaseCapability = "com.native-marketing/client-release";
4
+ export declare const releaseVersionSchema: z.ZodString;
5
+ export declare const clientIdentitySchema: z.ZodObject<{
6
+ version: z.ZodString;
7
+ contractVersion: z.ZodNumber;
8
+ apiMajor: z.ZodNumber;
9
+ }, z.core.$strip>;
10
+ export declare const clientReleaseSchema: z.ZodObject<{
11
+ schemaVersion: z.ZodLiteral<1>;
12
+ product: z.ZodLiteral<"native-marketing">;
13
+ version: z.ZodString;
14
+ packages: z.ZodObject<{
15
+ sdk: z.ZodLiteral<"@native-marketing/sdk">;
16
+ cli: z.ZodLiteral<"@native-marketing/cli">;
17
+ }, z.core.$strip>;
18
+ contractVersion: z.ZodNumber;
19
+ minimumClientVersion: z.ZodString;
20
+ apiMajor: z.ZodNumber;
21
+ nodeMajor: z.ZodNumber;
22
+ changes: z.ZodDefault<z.ZodArray<z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ export declare const updatePolicySchema: z.ZodObject<{
25
+ mode: z.ZodDefault<z.ZodEnum<{
26
+ auto: "auto";
27
+ notify: "notify";
28
+ off: "off";
29
+ }>>;
30
+ channel: z.ZodDefault<z.ZodEnum<{
31
+ beta: "beta";
32
+ latest: "latest";
33
+ next: "next";
34
+ }>>;
35
+ pin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
36
+ intervalHours: z.ZodDefault<z.ZodNumber>;
37
+ }, z.core.$strict>;
38
+ export declare const defaultUpdatePolicy: {
39
+ mode: "auto" | "notify" | "off";
40
+ channel: "beta" | "latest" | "next";
41
+ pin: string | null;
42
+ intervalHours: number;
43
+ };
44
+ export type NativeClientIdentity = z.infer<typeof clientIdentitySchema>;
45
+ export type NativeClientRelease = z.infer<typeof clientReleaseSchema>;
46
+ export type NativeUpdatePolicy = z.infer<typeof updatePolicySchema>;
47
+ export interface NativeCompatibility {
48
+ status: 'COMPATIBLE' | 'UPGRADE_RECOMMENDED' | 'INCOMPATIBLE' | 'UNKNOWN';
49
+ reason: 'CURRENT' | 'NEWER_CLIENT_AVAILABLE' | 'CLIENT_TOO_OLD' | 'CONTRACT_MISMATCH' | 'API_MISMATCH' | 'SERVER_METADATA_UNAVAILABLE';
50
+ client: NativeClientIdentity;
51
+ server: NativeClientRelease | null;
52
+ }
53
+ /** Exact SemVer precedence only; package-manager ranges are never interpreted here. */
54
+ export declare function compareReleaseVersions(left: string, right: string): number;
55
+ export declare function assessNativeCompatibility(client: NativeClientIdentity, server?: NativeClientRelease): NativeCompatibility;
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+ import { type NativeClientRelease, type NativeUpdatePolicy } from './client-lifecycle.js';
3
+ export declare const registryReleaseSchema: z.ZodObject<{
4
+ name: z.ZodEnum<{
5
+ "@native-marketing/cli": "@native-marketing/cli";
6
+ "@native-marketing/sdk": "@native-marketing/sdk";
7
+ }>;
8
+ version: z.ZodString;
9
+ deprecated: z.ZodOptional<z.ZodString>;
10
+ nativeMarketing: z.ZodOptional<z.ZodObject<{
11
+ contractVersion: z.ZodNumber;
12
+ apiMajor: z.ZodNumber;
13
+ nodeMajor: z.ZodNumber;
14
+ changes: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ }, z.core.$strip>>;
16
+ dist: z.ZodObject<{
17
+ integrity: z.ZodString;
18
+ }, z.core.$strip>;
19
+ }, z.core.$strip>;
20
+ export type NativeRegistryRelease = z.infer<typeof registryReleaseSchema>;
21
+ export declare const clientUpdateStateSchema: z.ZodObject<{
22
+ schemaVersion: z.ZodLiteral<1>;
23
+ policy: z.ZodObject<{
24
+ mode: z.ZodDefault<z.ZodEnum<{
25
+ auto: "auto";
26
+ notify: "notify";
27
+ off: "off";
28
+ }>>;
29
+ channel: z.ZodDefault<z.ZodEnum<{
30
+ beta: "beta";
31
+ latest: "latest";
32
+ next: "next";
33
+ }>>;
34
+ pin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
35
+ intervalHours: z.ZodDefault<z.ZodNumber>;
36
+ }, z.core.$strict>;
37
+ lastCheck: z.ZodOptional<z.ZodObject<{
38
+ at: z.ZodNumber;
39
+ selector: z.ZodString;
40
+ target: z.ZodObject<{
41
+ name: z.ZodEnum<{
42
+ "@native-marketing/cli": "@native-marketing/cli";
43
+ "@native-marketing/sdk": "@native-marketing/sdk";
44
+ }>;
45
+ version: z.ZodString;
46
+ deprecated: z.ZodOptional<z.ZodString>;
47
+ nativeMarketing: z.ZodOptional<z.ZodObject<{
48
+ contractVersion: z.ZodNumber;
49
+ apiMajor: z.ZodNumber;
50
+ nodeMajor: z.ZodNumber;
51
+ changes: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ }, z.core.$strip>>;
53
+ dist: z.ZodObject<{
54
+ integrity: z.ZodString;
55
+ }, z.core.$strip>;
56
+ }, z.core.$strip>;
57
+ }, z.core.$strict>>;
58
+ lastAttempt: z.ZodOptional<z.ZodObject<{
59
+ at: z.ZodNumber;
60
+ selector: z.ZodString;
61
+ }, z.core.$strict>>;
62
+ }, z.core.$strict>;
63
+ export type NativeClientUpdateState = z.infer<typeof clientUpdateStateSchema>;
64
+ export interface NativeUpdatePlan {
65
+ package: NativeRegistryRelease['name'];
66
+ currentVersion: string;
67
+ targetVersion: string;
68
+ status: 'CURRENT' | 'UPDATE_AVAILABLE' | 'BLOCKED';
69
+ reason: 'CURRENT' | 'COMPATIBLE_UPDATE' | 'REVIEW_REQUIRED' | 'PIN_MISMATCH' | 'CHANNEL_MISMATCH' | 'DOWNGRADE_FORBIDDEN' | 'METADATA_UNAVAILABLE' | 'CONTRACT_MISMATCH' | 'NODE_MISMATCH' | 'SERVER_INCOMPATIBLE' | 'DEPRECATED';
70
+ eligibleForAutoUpdate: boolean;
71
+ policy: NativeUpdatePolicy;
72
+ commands: {
73
+ npm: string[];
74
+ pnpm: string[];
75
+ yarn: string[] | null;
76
+ };
77
+ }
78
+ export declare function planNativeUpdate(input: {
79
+ target: NativeRegistryRelease;
80
+ currentVersion?: string;
81
+ policy?: NativeUpdatePolicy;
82
+ nodeMajor?: number;
83
+ server?: NativeClientRelease;
84
+ }): NativeUpdatePlan;
@@ -0,0 +1,14 @@
1
+ export declare const nativeClientRelease: {
2
+ readonly schemaVersion: 1;
3
+ readonly product: 'native-marketing';
4
+ readonly version: '0.3.7';
5
+ readonly packages: {
6
+ readonly sdk: '@native-marketing/sdk';
7
+ readonly cli: '@native-marketing/cli';
8
+ };
9
+ readonly contractVersion: 1;
10
+ readonly minimumClientVersion: '0.3.6';
11
+ readonly apiMajor: 1;
12
+ readonly nodeMajor: 24;
13
+ readonly changes: readonly ['Unified SDK, CLI and MCP release discovery and compatibility checks.', 'Configurable CLI update notifications, pins and compatible automatic updates.', 'Upgrade verification and explicit continuation without replaying business commands.'];
14
+ };
@@ -507,6 +507,8 @@ export declare const humanKnowledgeItemDetailSchema: z.ZodObject<{
507
507
  contentAvailable: z.ZodBoolean;
508
508
  projectBound: z.ZodNullable<z.ZodBoolean>;
509
509
  selected: z.ZodBoolean;
510
+ referenceRepairRequired: z.ZodOptional<z.ZodBoolean>;
511
+ resourceLinked: z.ZodOptional<z.ZodBoolean>;
510
512
  originalUrl: z.ZodNullable<z.ZodString>;
511
513
  evidenceRefs: z.ZodArray<z.ZodString>;
512
514
  relatedRefs: z.ZodArray<z.ZodString>;
@@ -107,6 +107,7 @@ export * from './business-command-receipt.js';
107
107
  export * from './operating-command-receipts.js';
108
108
  export * from './feedback-facts.js';
109
109
  export * from './knowledge-discovery.js';
110
+ export * from './knowledge-reference-repair.js';
110
111
  export * from './event-exchange.js';
111
112
  export * from './event-exchange-browser.js';
112
113
  export { EVENTSDK_WORKER_OBSERVATION_MAX_AGE_MS, eventDeliveryPageQuerySchema, eventDeliveryPageSchema, eventDeliveryRecoveryResultSchema, eventDeliveryRecoveryReceiptSchema, } from './event-delivery.js';
@@ -116,3 +117,5 @@ export * from './event-backlog.js';
116
117
  export * from './event-readiness.js';
117
118
  export * from './event-inbox.js';
118
119
  export * from './event-outbox-browser.js';
120
+ export * from './client-lifecycle.js';
121
+ export * from './client-update-policy.js';
@@ -133,9 +133,9 @@ export declare const knowledgeDiscoveryDescriptionSchema: z.ZodObject<{
133
133
  }, z.core.$strict>;
134
134
  export type KnowledgeDiscoveryDescription = z.infer<typeof knowledgeDiscoveryDescriptionSchema>;
135
135
  export declare const knowledgeAdoptionCommandSchema: z.ZodObject<{
136
- ref: z.ZodNonOptional<z.ZodString>;
137
136
  expectedContentHash: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
138
137
  requestId: z.ZodString;
138
+ ref: z.ZodString;
139
139
  }, z.core.$strict>;
140
140
  export declare const knowledgeAdoptionResultSchema: z.ZodObject<{
141
141
  result: z.ZodObject<{
@@ -213,3 +213,13 @@ export declare const adoptedKnowledgeResourceSchema: z.ZodObject<{
213
213
  identityHash: z.ZodString;
214
214
  }, z.core.$strict>;
215
215
  export type KnowledgeAdoptionCommand = z.infer<typeof knowledgeAdoptionCommandSchema>;
216
+ export declare const knowledgeResourceDescriptorSchema: z.ZodObject<{
217
+ ref: z.ZodString;
218
+ ownerTenantId: z.ZodString;
219
+ resourceType: z.ZodString;
220
+ identityHash: z.ZodString;
221
+ kind: z.ZodString;
222
+ classification: z.ZodString;
223
+ title: z.ZodString;
224
+ schemaVersion: z.ZodLiteral<1>;
225
+ }, z.core.$strict>;
@@ -0,0 +1,108 @@
1
+ import { z } from 'zod';
2
+ export declare const knowledgeReferenceRepairQuerySchema: z.ZodObject<{
3
+ sourceRef: z.ZodString;
4
+ }, z.core.$strict>;
5
+ export declare const knowledgeReferenceRepairPreviewSchema: z.ZodObject<{
6
+ sourceRef: z.ZodString;
7
+ remoteRef: z.ZodString;
8
+ basisHash: z.ZodString;
9
+ sourceTenantId: z.ZodString;
10
+ item: z.ZodObject<{
11
+ ref: z.ZodString;
12
+ ownerTenantId: z.ZodString;
13
+ resourceType: z.ZodString;
14
+ originType: z.ZodEnum<{
15
+ LEGACY_PROJECT: "LEGACY_PROJECT";
16
+ TENANT_AUTHOR: "TENANT_AUTHOR";
17
+ TENANT_SOURCE: "TENANT_SOURCE";
18
+ }>;
19
+ identityHash: z.ZodString;
20
+ identityKind: z.ZodEnum<{
21
+ CAS_BYTES: "CAS_BYTES";
22
+ REFERENCE_RECORD_DIGEST: "REFERENCE_RECORD_DIGEST";
23
+ }>;
24
+ kind: z.ZodString;
25
+ classification: z.ZodString;
26
+ mediaType: z.ZodString;
27
+ title: z.ZodString;
28
+ summary: z.ZodString;
29
+ readable: z.ZodBoolean;
30
+ reasonCodes: z.ZodArray<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ byteLength: z.ZodNumber;
33
+ verified: z.ZodLiteral<true>;
34
+ }, z.core.$strict>;
35
+ export declare const knowledgeReferenceRepairCommandSchema: z.ZodObject<{
36
+ sourceRef: z.ZodString;
37
+ requestId: z.ZodString;
38
+ expectedBasisHash: z.ZodString;
39
+ }, z.core.$strict>;
40
+ export declare const knowledgeReferenceRepairResultSchema: z.ZodObject<{
41
+ result: z.ZodObject<{
42
+ id: z.ZodString;
43
+ ref: z.ZodString;
44
+ tenantId: z.ZodString;
45
+ sourceType: z.ZodEnum<{
46
+ CASE_EVIDENCE: "CASE_EVIDENCE";
47
+ EXTERNAL_REFERENCE: "EXTERNAL_REFERENCE";
48
+ HOT_TOPIC: "HOT_TOPIC";
49
+ HUMAN_IDEA: "HUMAN_IDEA";
50
+ INSIGHT: "INSIGHT";
51
+ KNOWLEDGE: "KNOWLEDGE";
52
+ NEWS: "NEWS";
53
+ TREND: "TREND";
54
+ WORLD_FACT: "WORLD_FACT";
55
+ }>;
56
+ sourceRef: z.ZodString;
57
+ sourceAuthority: z.ZodString;
58
+ observedAt: z.ZodNullable<z.ZodString>;
59
+ validUntil: z.ZodNullable<z.ZodString>;
60
+ evidenceRef: z.ZodNullable<z.ZodString>;
61
+ snapshotHash: z.ZodNullable<z.ZodString>;
62
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
+ createdAt: z.ZodString;
64
+ }, z.core.$strip>;
65
+ replayed: z.ZodBoolean;
66
+ }, z.core.$strict>;
67
+ export declare const knowledgeReferenceRepairReceiptQuerySchema: z.ZodObject<{
68
+ requestId: z.ZodString;
69
+ }, z.core.$strict>;
70
+ export declare const knowledgeReferenceRepairReceiptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
+ state: z.ZodLiteral<"FOUND">;
72
+ result: z.ZodObject<{
73
+ id: z.ZodString;
74
+ ref: z.ZodString;
75
+ tenantId: z.ZodString;
76
+ sourceType: z.ZodEnum<{
77
+ CASE_EVIDENCE: "CASE_EVIDENCE";
78
+ EXTERNAL_REFERENCE: "EXTERNAL_REFERENCE";
79
+ HOT_TOPIC: "HOT_TOPIC";
80
+ HUMAN_IDEA: "HUMAN_IDEA";
81
+ INSIGHT: "INSIGHT";
82
+ KNOWLEDGE: "KNOWLEDGE";
83
+ NEWS: "NEWS";
84
+ TREND: "TREND";
85
+ WORLD_FACT: "WORLD_FACT";
86
+ }>;
87
+ sourceRef: z.ZodString;
88
+ sourceAuthority: z.ZodString;
89
+ observedAt: z.ZodNullable<z.ZodString>;
90
+ validUntil: z.ZodNullable<z.ZodString>;
91
+ evidenceRef: z.ZodNullable<z.ZodString>;
92
+ snapshotHash: z.ZodNullable<z.ZodString>;
93
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
94
+ createdAt: z.ZodString;
95
+ }, z.core.$strip>;
96
+ }, z.core.$strict>, z.ZodObject<{
97
+ state: z.ZodLiteral<"NOT_FOUND">;
98
+ result: z.ZodNull;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ state: z.ZodLiteral<"REJECTED">;
101
+ result: z.ZodNull;
102
+ error: z.ZodObject<{
103
+ code: z.ZodString;
104
+ outcome: z.ZodLiteral<"REJECTED">;
105
+ recovery: z.ZodString;
106
+ }, z.core.$strict>;
107
+ }, z.core.$strict>], "state">;
108
+ export type KnowledgeReferenceRepairPreview = z.infer<typeof knowledgeReferenceRepairPreviewSchema>;
@@ -0,0 +1,35 @@
1
+ import type { ContentFactoryClientOptions } from './client.js';
2
+ export declare function getNativeClientVersion(): {
3
+ schemaVersion: 1;
4
+ product: "native-marketing";
5
+ version: string;
6
+ packages: {
7
+ sdk: "@native-marketing/sdk";
8
+ cli: "@native-marketing/cli";
9
+ };
10
+ contractVersion: number;
11
+ minimumClientVersion: string;
12
+ apiMajor: number;
13
+ nodeMajor: number;
14
+ changes: string[];
15
+ };
16
+ export declare function checkNativeHttpVersion(options?: ContentFactoryClientOptions & {
17
+ timeoutMs?: number;
18
+ requireCompatibility?: boolean;
19
+ }): Promise<{
20
+ client: {
21
+ schemaVersion: 1;
22
+ product: "native-marketing";
23
+ version: string;
24
+ packages: {
25
+ sdk: "@native-marketing/sdk";
26
+ cli: "@native-marketing/cli";
27
+ };
28
+ contractVersion: number;
29
+ minimumClientVersion: string;
30
+ apiMajor: number;
31
+ nodeMajor: number;
32
+ changes: string[];
33
+ };
34
+ compatibility: import("../contracts/index.js").NativeCompatibility;
35
+ }>;
@@ -2,6 +2,7 @@ import type { paths } from './generated/schema.js';
2
2
  export interface ContentFactoryClientOptions {
3
3
  baseUrl?: string;
4
4
  fetch?: (input: Request) => Promise<Response>;
5
+ compatibility?: 'check' | 'require';
5
6
  }
6
7
  /** 共用认证HTTP入口,空写动作与生产代理保持一致的JSON传输合同。 */
7
8
  export declare function createContentFactoryClient(options?: ContentFactoryClientOptions): import("openapi-fetch").Client<paths, `${string}/${string}`>;