twin3-sdk 0.2.19-pre-alpha → 0.2.21-pre-alpha
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 +7 -4
- package/index.d.ts +79 -0
- package/js/ai-visibility.js +616 -0
- package/js/discovery-evidence.js +2 -1
- package/js/discovery.d.ts +21 -0
- package/js/discovery.js +10 -0
- package/js/discovery.mjs +10 -0
- package/js/index.js +3 -0
- package/js/index.mjs +10 -0
- package/js/internal/comm.js +16 -10
- package/js/internal/discovery.js +57 -21
- package/js/internal/settlement.js +28 -11
- package/js/runtime-session.js +75 -3
- package/package.json +3 -1
- package/runtime.d.ts +14 -0
- package/twin3/discovery/ai-visibility-catalog.json +68 -0
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ pip install -e /path/to/twin3-sdk
|
|
|
116
116
|
* Any protocol or algorithm improvement in `twin3-sdk` is reflected in both applications in **0 milliseconds**.
|
|
117
117
|
|
|
118
118
|
#### 2. Production Distribution
|
|
119
|
-
`v0.2.
|
|
119
|
+
`v0.2.21-pre-alpha` is the current release candidate: `0.2.21-pre-alpha` for npm and `0.2.21a0` for PyPI. Publication is pending approval and uses reviewed main through the existing Cloud Build tag trigger. Consumers must pin the exact released version and lock its registry integrity; never use a mutable range for a cryptographic protocol dependency. This release stays pre-alpha. Marketplace or sales copy may offer it for evaluation; it is not a stable release, and the npm dist-tag is `next`, not `latest`.
|
|
120
120
|
|
|
121
121
|
The additive `twin3-sdk/runtime` subpath provides a single-action Agent runtime candidate. Products retain authenticated authority, context egress consent, durable storage and trusted tool brokers. Python `twin3.runtime` provides compatible contracts and digests only. OpenShell, ADK and Hermes adapters are not included. See [runtime scope and limits](docs/architecture/PERSONAL-AGENT-RUNTIME-V1.md).
|
|
122
122
|
|
|
@@ -125,15 +125,15 @@ The additive `twin3-sdk/runtime` subpath provides a single-action Agent runtime
|
|
|
125
125
|
After publication, install the exact released version from the registry:
|
|
126
126
|
|
|
127
127
|
```bash
|
|
128
|
-
npm install twin3-sdk@0.2.
|
|
129
|
-
pip install twin3-sdk==0.2.
|
|
128
|
+
npm install twin3-sdk@0.2.21-pre-alpha
|
|
129
|
+
pip install twin3-sdk==0.2.21a0
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
For local evaluation, you can also use the packed npm tarball. Do not install from a git URL or a version range:
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
135
|
npm pack --ignore-scripts
|
|
136
|
-
npm install ./twin3-sdk-0.2.
|
|
136
|
+
npm install ./twin3-sdk-0.2.21-pre-alpha.tgz
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
---
|
|
@@ -146,6 +146,9 @@ Agent ID consumes Twin3 SDK to execute the **5-Stage A2A Autonomous Commercial L
|
|
|
146
146
|
2. **Understand**: Uses `twin3.matrix` to compute tolerance matching against industrial RFQs.
|
|
147
147
|
3. **Negotiate**: Uses `twin3.comm` and `twin3.shield` to exchange signed quotes without prompt-tampering risks.
|
|
148
148
|
4. **Settle**: Uses the Twin3 signed-receipt adapter at an HTTP 402 gate. Acceptance additionally requires a trusted signer key, a chain-specific finality verifier, and a shared replay store.
|
|
149
|
+
|
|
150
|
+
Settlement integrations must follow the [x402 security boundaries](docs/x402-security-boundaries.md),
|
|
151
|
+
including case-sensitive wallet binding, canonical network names and durable payment recovery.
|
|
149
152
|
5. **Dispute**: Invokes `twin3.governance` to resolve contractual non-performance.
|
|
150
153
|
|
|
151
154
|
### 👤 Human ID (Personal Sovereignty Projection)
|
package/index.d.ts
CHANGED
|
@@ -224,6 +224,85 @@ export interface EngineObservationReading {
|
|
|
224
224
|
export declare function normalizeEngineObservation(row: EngineObservationInput, options: { host: string }): EngineObservation;
|
|
225
225
|
export declare function summarizeEngineObservations(observations: EngineObservation[], options: { host: string; sourceLevel?: boolean }): EngineObservationReading;
|
|
226
226
|
export declare function summarizeCohortVisibility(readingsBySubject: Record<string, EngineObservationReading>, subjectId: string, options?: { minCohortSize?: number }): Record<string, any>;
|
|
227
|
+
export declare class AiVisibilityError extends Error { code: string; }
|
|
228
|
+
export declare const AI_REFERRAL_SCHEMA: "twin3-discovery-ai-referral-v1";
|
|
229
|
+
export declare const AI_CRAWLER_SCHEMA: "twin3-discovery-ai-crawler-v1";
|
|
230
|
+
export declare const AI_READINESS_SCHEMA: "twin3-discovery-ai-readiness-v1";
|
|
231
|
+
export declare const AI_TRAJECTORY_SCHEMA: "twin3-discovery-ai-trajectory-v1";
|
|
232
|
+
export type AiCrawlerPurpose = "training" | "search" | "user" | "agent" | "control";
|
|
233
|
+
export type AiTrajectoryStage = "crawled" | "search_indexed" | "user_fetched" | "retrieved" | "mentioned" | "cited" | "clicked";
|
|
234
|
+
export interface AiVisibilityCatalog {
|
|
235
|
+
version: number;
|
|
236
|
+
checked_on: string;
|
|
237
|
+
provenance: Array<{ name: string; url: string; license: string; used: string[] }>;
|
|
238
|
+
referral_sources: Array<{ key: string; operator: string; hosts: string[]; aliases: string[]; surfaces?: Array<{ key: string; medium: string }>; referrer_path?: string; utm?: boolean }>;
|
|
239
|
+
crawlers: Array<{ token: string; operator: string; purpose: AiCrawlerPurpose; robots: string; user_agent: boolean; claim?: string }>;
|
|
240
|
+
stages: Array<{ key: AiTrajectoryStage; en: string; "zh-TW": string }>;
|
|
241
|
+
}
|
|
242
|
+
export declare const AI_VISIBILITY_CATALOG: AiVisibilityCatalog;
|
|
243
|
+
export interface AiReferral {
|
|
244
|
+
schema: "twin3-discovery-ai-referral-v1";
|
|
245
|
+
source: string;
|
|
246
|
+
operator: string;
|
|
247
|
+
origin: "referrer" | "utm";
|
|
248
|
+
surface: string | null;
|
|
249
|
+
catalog_version: number;
|
|
250
|
+
}
|
|
251
|
+
export interface AiCrawler {
|
|
252
|
+
schema: "twin3-discovery-ai-crawler-v1";
|
|
253
|
+
token: string;
|
|
254
|
+
operator: string;
|
|
255
|
+
purpose: AiCrawlerPurpose;
|
|
256
|
+
robots: string;
|
|
257
|
+
catalog_version: number;
|
|
258
|
+
}
|
|
259
|
+
export interface AiReadinessCheck {
|
|
260
|
+
id: string;
|
|
261
|
+
priority: "P0" | "P1" | "P2" | "P3";
|
|
262
|
+
status: "pass" | "warn" | "fail" | "info" | "na";
|
|
263
|
+
evidence: Record<string, unknown>;
|
|
264
|
+
action: string | null;
|
|
265
|
+
}
|
|
266
|
+
export interface AiReadinessReport {
|
|
267
|
+
schema: "twin3-discovery-ai-readiness-v1";
|
|
268
|
+
host: string;
|
|
269
|
+
path: string;
|
|
270
|
+
catalog_version: number;
|
|
271
|
+
checks: AiReadinessCheck[];
|
|
272
|
+
crawler_access: Record<string, { operator: string; purpose: AiCrawlerPurpose; allowed: boolean; matched: "named" | "star" | "none" }>;
|
|
273
|
+
gate: { passed: boolean; blocking: string[] };
|
|
274
|
+
actions: Array<{ check: string; priority: "P0" | "P1" | "P2" | "P3"; action: string }>;
|
|
275
|
+
non_claims: string[];
|
|
276
|
+
digest: string;
|
|
277
|
+
}
|
|
278
|
+
export interface AiTrajectorySignal { state: "measured" | "withheld" | "unknown"; rate_bp: number | null; }
|
|
279
|
+
export interface AiTrajectoryOperator {
|
|
280
|
+
crawl: Record<"training" | "search" | "user" | "agent" | "other", number>;
|
|
281
|
+
refused: number;
|
|
282
|
+
engines: Record<string, Record<"retrieved" | "mentioned" | "cited", AiTrajectorySignal> & { answer_visibility_bp: number | null }>;
|
|
283
|
+
clicks: number;
|
|
284
|
+
click_sources: Record<string, number>;
|
|
285
|
+
click_surfaces: Record<string, number>;
|
|
286
|
+
stages: AiTrajectoryStage[];
|
|
287
|
+
}
|
|
288
|
+
export interface AiTrajectory {
|
|
289
|
+
schema: "twin3-discovery-ai-trajectory-v1";
|
|
290
|
+
host: string;
|
|
291
|
+
catalog_version: number;
|
|
292
|
+
operators: Record<string, AiTrajectoryOperator>;
|
|
293
|
+
totals: { fetched_requests: number; refused_requests: number; unclassified_requests: number; ai_sessions: number; non_ai_sessions: number };
|
|
294
|
+
reading_digest: string | null;
|
|
295
|
+
reading_valid: boolean | null;
|
|
296
|
+
unattributed_engines: string[];
|
|
297
|
+
score_weights: { mentioned: number; cited: number; divisor: number; source: string };
|
|
298
|
+
non_claims: string[];
|
|
299
|
+
digest: string;
|
|
300
|
+
}
|
|
301
|
+
export interface AiReferralRow { referrer?: string | null; landing_url?: string | null; utm_source?: string | null; sessions?: number; }
|
|
302
|
+
export declare function classifyAiReferral(referrer?: string | null, options?: { landingUrl?: string | null; utmSource?: string | null }): AiReferral | null;
|
|
303
|
+
export declare function classifyAiCrawler(userAgent: string): AiCrawler | null;
|
|
304
|
+
export declare function auditAiReadiness(options: { host: string; path?: string; robotsTxt?: string | null; html?: string | null; llmsTxt?: string | null }): AiReadinessReport;
|
|
305
|
+
export declare function summarizeAiTrajectory(options: { host: string; visits?: DiscoveryVisitEvidence[]; reading?: EngineObservationReading | null; referrals?: AiReferralRow[]; engineOperators?: Record<string, string> | null }): AiTrajectory;
|
|
227
306
|
export declare function buildSignedReferral(options: Record<string, any>): Record<string, any>;
|
|
228
307
|
export declare function verifySignedReferral(token: Record<string, any>, options: Record<string, any>): Record<string, any>;
|
|
229
308
|
|