@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.
@@ -1,5 +1,10 @@
1
1
  import { Client, type Tool } from '@modelcontextprotocol/client';
2
2
  import { type Profile } from './profile.js';
3
+ import { readNativeServerVersion } from './updates/version.js';
3
4
  /** 只访问远端正式工具;无本地数据库 fallback,也不重试未知结果的写操作。 */
4
- export declare function withClient<T>(profile: Profile, timeout: number, operation: (client: Client) => Promise<T>): Promise<T>;
5
+ export declare function withClient<T>(profile: Profile, timeout: number, operation: (client: Client) => Promise<T>, options?: {
6
+ requireCompatibility?: boolean;
7
+ allowIncompatible?: boolean;
8
+ onVersion?: (version: ReturnType<typeof readNativeServerVersion>) => void;
9
+ }): Promise<T>;
5
10
  export declare function callTool(client: Client, tool: Tool, input: Record<string, unknown>, timeout: number, readOnly: boolean, errorToolName?: string): Promise<unknown>;
@@ -0,0 +1,11 @@
1
+ import type { ParsedArgs } from '../cli/input.js';
2
+ type Output = {
3
+ command: string;
4
+ data: unknown;
5
+ };
6
+ export declare function runLifecycleCommand(parsed: ParsedArgs, env: NodeJS.ProcessEnv, executablePath?: string): Promise<Output | null>;
7
+ export declare function maybeAutoUpdate(env: NodeJS.ProcessEnv, io: {
8
+ executablePath?: string;
9
+ notify?: (message: string) => void;
10
+ }, timeout: number): Promise<Output | null>;
11
+ export {};
@@ -0,0 +1,20 @@
1
+ import { type NativeRegistryRelease, type NativeUpdatePolicy } from '../../contracts/index.js';
2
+ /** The only subprocess adapter in the client: fixed npm installation and version verification. */
3
+ export declare function installCliUpdate(input: {
4
+ target: NativeRegistryRelease;
5
+ currentVersion?: string;
6
+ policy: NativeUpdatePolicy;
7
+ executablePath?: string;
8
+ allowBreaking?: boolean;
9
+ automatic?: boolean;
10
+ timeoutMs: number;
11
+ env: NodeJS.ProcessEnv;
12
+ }): Promise<{
13
+ state: string;
14
+ package: "@native-marketing/cli" | "@native-marketing/sdk";
15
+ previousVersion: string;
16
+ installedVersion: string;
17
+ restartRequired: boolean;
18
+ originalCommandExecuted: boolean;
19
+ recovery: string[];
20
+ }>;
@@ -0,0 +1,26 @@
1
+ import { type NativeClientRelease, type NativeUpdatePolicy } from '../../contracts/index.js';
2
+ export declare function checkNativeUpdates(options?: {
3
+ package?: 'sdk' | 'cli';
4
+ currentVersion?: string;
5
+ policy?: NativeUpdatePolicy;
6
+ server?: NativeClientRelease;
7
+ timeoutMs?: number;
8
+ fetch?: typeof fetch;
9
+ }): Promise<{
10
+ checkedAt: number;
11
+ target: {
12
+ name: "@native-marketing/cli" | "@native-marketing/sdk";
13
+ version: string;
14
+ deprecated?: string | undefined;
15
+ nativeMarketing?: {
16
+ contractVersion: number;
17
+ apiMajor: number;
18
+ nodeMajor: number;
19
+ changes?: string[] | undefined;
20
+ } | undefined;
21
+ dist: {
22
+ integrity: string;
23
+ };
24
+ };
25
+ plan: import("../../contracts/index.js").NativeUpdatePlan;
26
+ }>;
@@ -0,0 +1,14 @@
1
+ import { type NativeClientUpdateState as State, type NativeUpdatePolicy } from '../../contracts/index.js';
2
+ export declare class UpdateStore {
3
+ private readonly files;
4
+ constructor(env: NodeJS.ProcessEnv);
5
+ read(): Promise<State>;
6
+ locked<T>(action: () => Promise<T>): Promise<T>;
7
+ change(action: (state: State) => State): Promise<State>;
8
+ }
9
+ export declare function effectiveUpdatePolicy(policy: NativeUpdatePolicy, env: NodeJS.ProcessEnv): {
10
+ mode: "auto" | "notify" | "off";
11
+ channel: "beta" | "latest" | "next";
12
+ pin: string | null;
13
+ intervalHours: number;
14
+ };
@@ -0,0 +1,93 @@
1
+ import type { Client } from '@modelcontextprotocol/client';
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 getNativeCliVersion(executablePath?: string): Promise<{
17
+ schemaVersion: 1;
18
+ product: "native-marketing";
19
+ version: string;
20
+ packages: {
21
+ sdk: "@native-marketing/sdk";
22
+ cli: "@native-marketing/cli";
23
+ };
24
+ contractVersion: number;
25
+ minimumClientVersion: string;
26
+ apiMajor: number;
27
+ nodeMajor: number;
28
+ changes: string[];
29
+ sdkVersion: "0.3.7";
30
+ }>;
31
+ export declare function readNativeServerVersion(client: Client): {
32
+ client: {
33
+ schemaVersion: 1;
34
+ product: "native-marketing";
35
+ version: string;
36
+ packages: {
37
+ sdk: "@native-marketing/sdk";
38
+ cli: "@native-marketing/cli";
39
+ };
40
+ contractVersion: number;
41
+ minimumClientVersion: string;
42
+ apiMajor: number;
43
+ nodeMajor: number;
44
+ changes: string[];
45
+ };
46
+ serverInfo: {
47
+ version: string;
48
+ websiteUrl?: string | undefined;
49
+ description?: string | undefined;
50
+ icons?: {
51
+ src: string;
52
+ mimeType?: string | undefined;
53
+ sizes?: string[] | undefined;
54
+ theme?: "dark" | "light" | undefined;
55
+ }[] | undefined;
56
+ name: string;
57
+ title?: string | undefined;
58
+ } | null;
59
+ mcpProtocolVersion: string | null;
60
+ compatibility: import("../../contracts/index.js").NativeCompatibility;
61
+ };
62
+ export declare function assertNativeCompatibility(result: ReturnType<typeof readNativeServerVersion>, required?: boolean): void;
63
+ export declare function refreshNativeServerVersion(client: Client, timeout: number): Promise<{
64
+ client: {
65
+ schemaVersion: 1;
66
+ product: "native-marketing";
67
+ version: string;
68
+ packages: {
69
+ sdk: "@native-marketing/sdk";
70
+ cli: "@native-marketing/cli";
71
+ };
72
+ contractVersion: number;
73
+ minimumClientVersion: string;
74
+ apiMajor: number;
75
+ nodeMajor: number;
76
+ changes: string[];
77
+ };
78
+ serverInfo: {
79
+ version: string;
80
+ websiteUrl?: string | undefined;
81
+ description?: string | undefined;
82
+ icons?: {
83
+ src: string;
84
+ mimeType?: string | undefined;
85
+ sizes?: string[] | undefined;
86
+ theme?: "dark" | "light" | undefined;
87
+ }[] | undefined;
88
+ name: string;
89
+ title?: string | undefined;
90
+ } | null;
91
+ mcpProtocolVersion: string | null;
92
+ compatibility: import("../../contracts/index.js").NativeCompatibility;
93
+ }>;