@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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.js CHANGED
@@ -6818,7 +6818,18 @@ var surveyRejections = [
6818
6818
  "PERSONAL_SURVEY_DRAFT_TRANSITION_IMMUTABLE"
6819
6819
  ];
6820
6820
  function isKnownCapabilityRejection(code2, name) {
6821
- return capabilityRejectedErrorCodes.includes(code2) || code2 === "INVALID_CURSOR" && isChangeAcknowledgement(name) || surveyWrites.includes(name ?? "") && surveyRejections.includes(code2) || researchWrites.includes(name ?? "") && ["FOUNDATION_RECORD_CONFLICT", "FOUNDATION_INPUT_REQUIRED"].includes(code2);
6821
+ return capabilityRejectedErrorCodes.includes(code2) || name === "cf_adopt_discovered_knowledge" && [
6822
+ "KNOWLEDGE_DISCOVERY_IDENTITY_CHANGED",
6823
+ "KNOWLEDGE_DISCOVERY_FORBIDDEN",
6824
+ "KNOWLEDGE_DISCOVERY_TEXT_TOO_LARGE",
6825
+ "KNOWLEDGE_DISCOVERY_TEXT_UNSUPPORTED",
6826
+ "KNOWLEDGE_DISCOVERY_UNAVAILABLE",
6827
+ "KNOWLEDGE_CATALOG_UNAVAILABLE",
6828
+ "KNOWLEDGE_CATALOG_INVALID",
6829
+ "KNOWLEDGE_CATALOG_SCOPE_NOT_CONFIGURED",
6830
+ "KNOWLEDGE_PROVIDER_AUTH_REQUIRED",
6831
+ "KNOWLEDGE_TENANT_IDENTITY_CHANGED"
6832
+ ].includes(code2) || code2 === "INVALID_CURSOR" && isChangeAcknowledgement(name) || surveyWrites.includes(name ?? "") && surveyRejections.includes(code2) || researchWrites.includes(name ?? "") && ["FOUNDATION_RECORD_CONFLICT", "FOUNDATION_INPUT_REQUIRED"].includes(code2);
6822
6833
  }
6823
6834
  var recoveries = {
6824
6835
  CAPABILITY_SCHEMA_CHANGED: "READ_EXACT_SCHEMA",
@@ -6890,6 +6901,167 @@ function capabilityRecovery(code2, outcome, name) {
6890
6901
  return "CHECK_ACCESS_OR_REFRESH_EXACT_INPUT";
6891
6902
  }
6892
6903
 
6904
+ // packages/contracts/src/event-exchange.ts
6905
+ import { z as z99 } from "zod";
6906
+
6907
+ // packages/contracts/src/event-exchange-browser.ts
6908
+ import { z as z98 } from "zod";
6909
+ var ref2 = z98.string().min(1).max(2048);
6910
+ var eventExchangeSourceSchema = z98.object({ source: ref2, serviceRef: ref2, tenantRef: ref2, issuer: ref2, subject: ref2 }).strict();
6911
+ var eventExchangeTargetSchema = z98.object({ serviceRef: ref2, tenantRef: ref2 }).strict();
6912
+ var eventExchangeBrowserCommandSchema = z98.object({
6913
+ schemaVersion: z98.literal(1),
6914
+ requestId: z98.string().min(1).max(256),
6915
+ expectedRevision: z98.number().int().positive().nullable(),
6916
+ source: eventExchangeSourceSchema,
6917
+ target: eventExchangeTargetSchema,
6918
+ grant: z98.object({
6919
+ grantRef: z98.string().min(1).max(256),
6920
+ version: z98.number().int().positive(),
6921
+ eventType: z98.string().min(1).max(256),
6922
+ consumerRef: ref2
6923
+ }).strict(),
6924
+ status: z98.enum(["ACTIVE", "REVOKED"])
6925
+ }).strict();
6926
+
6927
+ // packages/contracts/src/event-exchange.ts
6928
+ var eventExchangePageQuerySchema = z99.object({
6929
+ after: z99.string().max(256).default(""),
6930
+ limit: z99.number().int().min(1).max(100).default(50)
6931
+ }).strict();
6932
+ var eventExchangeReceiptQuerySchema = z99.object({ requestId: z99.string().min(1).max(256) }).strict();
6933
+ var knowledgeRefreshRevisionSchema = z99.object({
6934
+ schemaVersion: z99.literal(1),
6935
+ revision: z99.string().regex(/^\d+$/),
6936
+ recordedAt: z99.string().datetime().nullable(),
6937
+ baselines: z99.array(
6938
+ z99.object({
6939
+ connectionRef: z99.string(),
6940
+ source: z99.string(),
6941
+ baselineRef: z99.string(),
6942
+ watermark: z99.string().regex(/^\d+$/),
6943
+ sourceRevision: z99.string()
6944
+ }).strict()
6945
+ ).max(100).default([]),
6946
+ baselinesTruncated: z99.boolean().default(false)
6947
+ }).strict();
6948
+ var exchangeStatus = z99.enum(["ACTIVE", "REVOKED"]);
6949
+ var direction = z99.enum(["OUTBOUND", "RECEIVE"]);
6950
+ var eventExchangeResultSchema = z99.object({
6951
+ schemaVersion: z99.literal(1),
6952
+ connectionRef: z99.string().regex(/^urn:eventsdk:connection:[a-f0-9]{64}$/),
6953
+ revision: z99.number().int().positive(),
6954
+ direction,
6955
+ status: exchangeStatus,
6956
+ grantRef: z99.string().min(1).max(256),
6957
+ grantVersion: z99.number().int().positive(),
6958
+ eventType: z99.string().optional()
6959
+ }).strict();
6960
+ var eventExchangeReceiptSchema = z99.object({
6961
+ schemaVersion: z99.literal(1),
6962
+ requestId: z99.string().min(1).max(256),
6963
+ result: eventExchangeResultSchema.nullable()
6964
+ }).strict();
6965
+ var eventExchangePageSchema = z99.object({
6966
+ schemaVersion: z99.literal(1),
6967
+ localTenant: eventExchangeTargetSchema.optional(),
6968
+ items: z99.array(
6969
+ eventExchangeResultSchema.pick({
6970
+ connectionRef: true,
6971
+ revision: true,
6972
+ direction: true,
6973
+ status: true
6974
+ }).extend({
6975
+ source: eventExchangeSourceSchema.optional(),
6976
+ target: eventExchangeTargetSchema.optional(),
6977
+ grantsTruncated: z99.boolean().optional(),
6978
+ grants: z99.array(
6979
+ z99.object({
6980
+ eventType: z99.string(),
6981
+ grantRef: z99.string(),
6982
+ grantVersion: z99.number().int().positive(),
6983
+ consumerRef: z99.string().optional(),
6984
+ source: eventExchangeSourceSchema.optional(),
6985
+ target: eventExchangeTargetSchema.optional(),
6986
+ status: exchangeStatus
6987
+ }).strict()
6988
+ ).max(100).optional()
6989
+ })
6990
+ ).max(100),
6991
+ nextAfter: z99.string().max(256).nullable()
6992
+ }).strict();
6993
+
6994
+ // packages/contracts/src/knowledge-discovery.ts
6995
+ import { z as z100 } from "zod";
6996
+ var knowledgeRemoteRefSchema = z100.string().min(1).max(4096).refine((value) => {
6997
+ try {
6998
+ const url = new URL(value);
6999
+ return !url.username && !url.password && /^[a-z][a-z0-9+.-]*:$/.test(url.protocol);
7000
+ } catch {
7001
+ return false;
7002
+ }
7003
+ });
7004
+ var knowledgeDiscoveryQuerySchema = z100.object({
7005
+ q: z100.string().trim().min(2).max(160).optional(),
7006
+ cursor: z100.string().min(1).max(8192).optional(),
7007
+ resourceType: z100.string().regex(/^[a-z][a-z0-9._-]{0,63}$/).optional(),
7008
+ limit: z100.number().int().min(1).max(50).default(20)
7009
+ }).strict();
7010
+ var knowledgeDiscoveryReadQuerySchema = z100.object({
7011
+ ref: knowledgeRemoteRefSchema,
7012
+ expectedContentHash: z100.string().regex(/^sha256:[a-f0-9]{64}$/).optional()
7013
+ }).strict();
7014
+ var knowledgeDiscoveryItemSchema = z100.object({
7015
+ ref: knowledgeRemoteRefSchema,
7016
+ ownerTenantId: z100.string().min(1).max(256),
7017
+ resourceType: z100.string().min(1).max(128),
7018
+ originType: z100.enum(["LEGACY_PROJECT", "TENANT_AUTHOR", "TENANT_SOURCE"]),
7019
+ identityHash: z100.string().regex(/^sha256:[a-f0-9]{64}$/),
7020
+ identityKind: z100.enum(["CAS_BYTES", "REFERENCE_RECORD_DIGEST"]),
7021
+ kind: z100.string().min(1).max(128),
7022
+ classification: z100.string().max(128),
7023
+ mediaType: z100.string().min(1).max(256),
7024
+ title: z100.string().max(512),
7025
+ summary: z100.string().max(1024),
7026
+ readable: z100.boolean(),
7027
+ reasonCodes: z100.array(z100.string().max(128)).max(32)
7028
+ });
7029
+ var knowledgeDiscoveryPageSchema = z100.object({
7030
+ schemaVersion: z100.literal(1),
7031
+ sourceTenantId: z100.string().min(1).max(256),
7032
+ items: z100.array(knowledgeDiscoveryItemSchema).max(50),
7033
+ pageInfo: z100.object({ nextCursor: z100.string().max(8192).nullable() }).strict(),
7034
+ coverage: z100.enum(["CURRENT_AUTHORIZED_DIRECTORY", "INDEXED_DESCRIPTIONS_ONLY"]),
7035
+ checkedAt: z100.string().datetime()
7036
+ }).strict();
7037
+ var knowledgeDiscoveryReadSchema = z100.object({
7038
+ schemaVersion: z100.literal(1),
7039
+ sourceTenantId: z100.string().min(1).max(256),
7040
+ item: knowledgeDiscoveryItemSchema,
7041
+ contentHash: z100.string().regex(/^sha256:[a-f0-9]{64}$/),
7042
+ mediaType: z100.string().min(1).max(256),
7043
+ byteLength: z100.number().int().min(0).max(524288),
7044
+ content: z100.string().max(524288),
7045
+ verified: z100.literal(true),
7046
+ checkedAt: z100.string().datetime()
7047
+ }).strict();
7048
+ var knowledgeAdoptionCommandSchema = knowledgeDiscoveryReadQuerySchema.required().extend({
7049
+ requestId: z100.string().min(1).max(128)
7050
+ }).strict();
7051
+ var knowledgeAdoptionResultSchema = z100.object({ result: sourceRefSchema, replayed: z100.boolean() }).strict();
7052
+ var knowledgeAdoptionReceiptQuerySchema = z100.object({ requestId: z100.string().min(1).max(128) }).strict();
7053
+ var knowledgeAdoptionReceiptSchema = z100.discriminatedUnion("state", [
7054
+ z100.object({ state: z100.literal("FOUND"), result: sourceRefSchema }).strict(),
7055
+ z100.object({ state: z100.literal("NOT_FOUND"), result: z100.null() }).strict(),
7056
+ commandRejectedReceiptSchema
7057
+ ]);
7058
+ var adoptedKnowledgeResourceSchema = z100.object({
7059
+ schemaVersion: z100.literal(1),
7060
+ sourceTenantId: z100.string().min(1).max(256),
7061
+ ref: knowledgeRemoteRefSchema,
7062
+ identityHash: z100.string().regex(/^sha256:[a-f0-9]{64}$/)
7063
+ }).strict();
7064
+
6893
7065
  // packages/contracts/src/agent/capability-receipts.ts
6894
7066
  var rule = (capability, schema2, operation, keys = [], field) => ({ capability, schema: schema2, operation, keys, field });
6895
7067
  var foundation = (operation, field) => rule(
@@ -6911,6 +7083,18 @@ var execution = (family, operation) => ({
6911
7083
  });
6912
7084
  var learning = (op) => rule("cf_get_learning_command_receipt", learningReceiptSchema, op);
6913
7085
  var rules = {
7086
+ cf_configure_event_exchange: rule(
7087
+ "cf_get_event_exchange_receipt",
7088
+ eventExchangeReceiptQuerySchema
7089
+ ),
7090
+ cf_recover_event_outbox: rule(
7091
+ "cf_get_event_outbox_recovery_receipt",
7092
+ eventExchangeReceiptQuerySchema
7093
+ ),
7094
+ cf_adopt_discovered_knowledge: rule(
7095
+ "cf_get_knowledge_adoption_receipt",
7096
+ knowledgeAdoptionReceiptQuerySchema
7097
+ ),
6914
7098
  cf_save_test_record: rule("cf_get_test_record_receipt", testRecordReceiptSchema, "SAVE"),
6915
7099
  cf_cleanup_test_records: rule("cf_get_test_record_receipt", testRecordReceiptSchema, "CLEANUP"),
6916
7100
  cf_register_source: rule(
@@ -7122,7 +7306,7 @@ function capabilityReceiptRead(name, input) {
7122
7306
  }
7123
7307
 
7124
7308
  // packages/contracts/src/agent/capability-status.ts
7125
- import { z as z98 } from "zod";
7309
+ import { z as z101 } from "zod";
7126
7310
  var verification = {
7127
7311
  capability: "cf_material_verification_status",
7128
7312
  schema: materialVerificationIdSchema,
@@ -7140,7 +7324,7 @@ var rules2 = {
7140
7324
  },
7141
7325
  cf_tenant_material_scan_advance: {
7142
7326
  capability: "cf_tenant_material_scan_status",
7143
- schema: z98.object({}).strict()
7327
+ schema: z101.object({}).strict()
7144
7328
  },
7145
7329
  cf_sync_materials: {
7146
7330
  capability: "cf_reconcile_materials",
@@ -7530,7 +7714,9 @@ function knowledgeError(tool5, raw) {
7530
7714
  if (typeof error.checkedAt === "string" && /^\d{4}-\d{2}-\d{2}T[\d:.]+Z$/.test(error.checkedAt))
7531
7715
  details.checkedAt = error.checkedAt;
7532
7716
  const descriptor = object2(error.descriptor);
7533
- if (descriptor && typeof descriptor.readingPath === "string" && /^\/projects\/PRJ-\d{6,}\/knowledge\/library\/[0-9a-f-]{36}$/i.test(descriptor.readingPath))
7717
+ if (descriptor && typeof descriptor.readingPath === "string" && /^\/(?:projects\/PRJ|tenants\/TEN)-\d{6,}\/knowledge\/library\/[0-9a-f-]{36}$/i.test(
7718
+ descriptor.readingPath
7719
+ ))
7534
7720
  details.readingPath = descriptor.readingPath;
7535
7721
  return new CliError(
7536
7722
  error.code,
@@ -7992,7 +8178,7 @@ function reviewLinks(resource, tool5, result2, input = {}) {
7992
8178
  }
7993
8179
  return {};
7994
8180
  }
7995
- if (tool5 === "cf_read_knowledge" && result2 && typeof result2 === "object" && "readingPath" in result2 && typeof result2.readingPath === "string" && /^\/projects\/PRJ-\d{6,}\/knowledge\/library\/[0-9a-f-]{36}$/i.test(result2.readingPath)) {
8181
+ if (tool5 === "cf_read_knowledge" && result2 && typeof result2 === "object" && "readingPath" in result2 && typeof result2.readingPath === "string" && knowledgePathMatchesResource(result2.readingPath, url.pathname)) {
7996
8182
  return { readingUrl: new URL(result2.readingPath, url.origin).href };
7997
8183
  }
7998
8184
  if (tool5 === "cf_submit_intelligence_candidate" && url.pathname === "/mcp/me" && result2 && typeof result2 === "object" && "businessCode" in result2 && typeof result2.businessCode === "string" && /^INT-[0-9]{6,}$/.test(result2.businessCode)) {
@@ -8020,6 +8206,13 @@ function reviewLinks(resource, tool5, result2, input = {}) {
8020
8206
  }
8021
8207
  return { workspaceUrl: url.origin + (tenant ? "/foundation" : "/me/identity") };
8022
8208
  }
8209
+ function knowledgePathMatchesResource(readingPath, resourcePath) {
8210
+ const resource = /^\/mcp\/((?:projects\/PRJ|tenants\/TEN)-\d{6,})$/.exec(resourcePath);
8211
+ const path = /^\/((?:projects\/PRJ|tenants\/TEN)-\d{6,})\/knowledge\/library\/[0-9a-f-]{36}$/i.exec(
8212
+ readingPath
8213
+ );
8214
+ return Boolean(resource && path && resource[1] === path[1]);
8215
+ }
8023
8216
 
8024
8217
  // packages/cli-client/src/operations.ts
8025
8218
  async function inspectNativeTool(client, name, timeout = 3e4) {
@@ -8819,13 +9012,24 @@ var commandTools = {
8819
9012
  "source read": "cf_get_opportunity_source",
8820
9013
  // 目录/正文与任务冻结 source read 分离,避免把当前知识替换为任务证据。
8821
9014
  "knowledge list": "cf_list_knowledge",
9015
+ "knowledge discover": "cf_discover_knowledge",
9016
+ "knowledge adopt": "cf_adopt_discovered_knowledge",
9017
+ "knowledge adoption-receipt": "cf_get_knowledge_adoption_receipt",
9018
+ "knowledge read-discovered": "cf_read_discovered_knowledge",
8822
9019
  "knowledge materials": "cf_list_materials",
9020
+ "knowledge topics": "cf_list_material_topics",
8823
9021
  "knowledge read": "cf_read_knowledge",
9022
+ "knowledge read-source": "cf_read_source",
8824
9023
  "knowledge select": "cf_select_knowledge",
8825
9024
  "knowledge collect": "cf_collect_materials",
8826
- "knowledge sync": "cf_sync_materials",
8827
9025
  "knowledge tenant-status": "cf_tenant_material_scan_status",
8828
- "knowledge tenant-advance": "cf_tenant_material_scan_advance",
9026
+ "knowledge reconcile": "cf_reconcile_materials",
9027
+ "event-exchanges list": "cf_list_event_exchanges",
9028
+ "event-exchanges configure": "cf_configure_event_exchange",
9029
+ "event-exchanges receipt": "cf_get_event_exchange_receipt",
9030
+ "event-exchanges outbox-list": "cf_list_event_outbox",
9031
+ "event-exchanges outbox-recover": "cf_recover_event_outbox",
9032
+ "event-exchanges outbox-receipt": "cf_get_event_outbox_recovery_receipt",
8829
9033
  "knowledge verify-start": "cf_material_verification_start",
8830
9034
  "knowledge verify-status": "cf_material_verification_status",
8831
9035
  "knowledge verify-advance": "cf_material_verification_advance",
@@ -9025,7 +9229,9 @@ function resolveBaseCommand(parsed) {
9025
9229
  function resolveCommand(parsed) {
9026
9230
  const removed = {
9027
9231
  doctor: "context",
9028
- "knowledge sync-all": "knowledge sync"
9232
+ "knowledge sync-all": "knowledge discover",
9233
+ "knowledge sync": "knowledge discover",
9234
+ "knowledge tenant-advance": "knowledge discover"
9029
9235
  };
9030
9236
  const replacement = removed[parsed.words.join(" ")];
9031
9237
  if (replacement)
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@native-marketing/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
- "license": "UNLICENSED",
5
+ "license": "Apache-2.0",
6
6
  "engines": {
7
7
  "node": ">=24 <25"
8
8
  },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/SENLIN746/native-marketing.git"
12
- },
13
9
  "publishConfig": {
14
10
  "access": "public",
15
11
  "registry": "https://registry.npmjs.org/"
@@ -17,10 +13,9 @@
17
13
  "files": [
18
14
  "dist/",
19
15
  "types/",
20
- "README.md",
16
+ "LICENSE",
21
17
  "release.json"
22
18
  ],
23
- "description": "Authenticated Native Marketing MCP and HTTP clients; no Runtime or database access",
24
19
  "exports": {
25
20
  ".": {
26
21
  "types": "./types/sdk/index.d.ts",
package/release.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "sourceCommit": "351676c470fe22c510ee38fe9c3e6032de241407",
2
+ "sourceCommit": "afa0dc260d267c9f7fa1da3ff3e629325bf5a6a1",
3
3
  "workingTreeDirty": false,
4
- "version": "0.2.0",
5
- "openapiTypesSha256": "ab00b08c6f94b2b39d7f4010de2335d70be26e7987e9db6dc57fa308426aecc4",
4
+ "version": "0.3.1",
5
+ "openapiTypesSha256": "1a86e24ce9e458e945e4df5e9c7423c9bf4253ac24b3f627f67ba38c92856a38",
6
6
  "localBuild": true
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- /** 知识工具只选择已授权项目内的来源;不允许输入租户、凭据或任意上游地址。 */
2
+ /** 知识工具只选择当前 OAuth Tenant/项目内的来源;不允许输入租户、凭据或任意上游地址。 */
3
3
  export declare const mcpKnowledgeListSchema: z.ZodObject<{
4
4
  q: z.ZodOptional<z.ZodString>;
5
5
  kind: z.ZodOptional<z.ZodEnum<{
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ export declare const eventBacklogObservationSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ observedAt: z.ZodString;
5
+ outbox: z.ZodObject<{
6
+ pendingCount: z.ZodNumber;
7
+ oldestPendingAt: z.ZodNullable<z.ZodString>;
8
+ oldestPendingAgeMs: z.ZodNullable<z.ZodNumber>;
9
+ oldestKnownPendingAt: z.ZodNullable<z.ZodString>;
10
+ unknownAgeCount: z.ZodNumber;
11
+ reasons: z.ZodArray<z.ZodObject<{
12
+ status: z.ZodString;
13
+ reasonCode: z.ZodNullable<z.ZodString>;
14
+ count: z.ZodNumber;
15
+ }, z.core.$strict>>;
16
+ reasonsTruncated: z.ZodBoolean;
17
+ }, z.core.$strict>;
18
+ unstaged: z.ZodObject<{
19
+ deliveryCount: z.ZodNumber;
20
+ oldestRecordedAt: z.ZodNullable<z.ZodString>;
21
+ }, z.core.$strict>;
22
+ inbox: z.ZodObject<{
23
+ pendingCount: z.ZodNumber;
24
+ oldestPendingAt: z.ZodNullable<z.ZodString>;
25
+ oldestPendingAgeMs: z.ZodNullable<z.ZodNumber>;
26
+ oldestKnownPendingAt: z.ZodNullable<z.ZodString>;
27
+ unknownAgeCount: z.ZodNumber;
28
+ reasons: z.ZodArray<z.ZodObject<{
29
+ status: z.ZodString;
30
+ reasonCode: z.ZodNullable<z.ZodString>;
31
+ count: z.ZodNumber;
32
+ }, z.core.$strict>>;
33
+ reasonsTruncated: z.ZodBoolean;
34
+ pendingBaselines: z.ZodNumber;
35
+ sourceGapState: z.ZodLiteral<"NOT_OBSERVED">;
36
+ }, z.core.$strict>;
37
+ quarantine: z.ZodObject<{
38
+ attributedRouteAttempts: z.ZodNumber;
39
+ coverage: z.ZodLiteral<"LOCAL_ROUTE_ATTEMPTS_ONLY">;
40
+ reasons: z.ZodArray<z.ZodObject<{
41
+ status: z.ZodString;
42
+ reasonCode: z.ZodNullable<z.ZodString>;
43
+ count: z.ZodNumber;
44
+ }, z.core.$strict>>;
45
+ reasonsTruncated: z.ZodBoolean;
46
+ }, z.core.$strict>;
47
+ }, z.core.$strict>;