stitchkit 0.118.1 → 0.119.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/CHANGELOG.md +66 -0
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/contract/client-types.d.ts +6 -3
- package/dist/contract/client-types.d.ts.map +1 -1
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts +18 -12
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/endpoint-capabilities.d.ts +28 -0
- package/dist/contract/endpoint-capabilities.d.ts.map +1 -0
- package/dist/contract/factory.d.ts +49 -19
- package/dist/contract/factory.d.ts.map +1 -1
- package/dist/contract/tool-view.d.ts +1 -1
- package/dist/contract/tool-view.d.ts.map +1 -1
- package/dist/contract/transports.d.ts +5 -0
- package/dist/contract/transports.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +6 -5
- package/dist/entrypoints/agent-runtime/harness.js +6 -5
- package/dist/entrypoints/agent-runtime/sandbox.js +6 -5
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +9 -8
- package/dist/entrypoints/agent-runtime/sqlite/node.js +9 -8
- package/dist/entrypoints/agent-runtime/testing.js +9 -8
- package/dist/entrypoints/agent-runtime.js +14 -13
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +4 -4
- package/dist/entrypoints/application/opentelemetry.js +1 -1
- package/dist/entrypoints/application.js +5 -5
- package/dist/entrypoints/cli/publish.js +4 -4
- package/dist/entrypoints/cli.js +8 -7
- package/dist/entrypoints/contract.d.ts +1 -1
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +6 -4
- package/dist/entrypoints/files.js +3 -3
- package/dist/entrypoints/geo/contract.d.ts +7 -0
- package/dist/entrypoints/geo/contract.d.ts.map +1 -0
- package/dist/entrypoints/geo/contract.js +6 -0
- package/dist/entrypoints/geo.js +60 -23
- package/dist/entrypoints/http.js +2 -2
- package/dist/entrypoints/index.js +8 -6
- package/dist/entrypoints/live.js +1 -1
- package/dist/entrypoints/node.js +7 -6
- package/dist/entrypoints/primitives.js +1 -1
- package/dist/entrypoints/process/owner-loss.js +1 -1
- package/dist/entrypoints/process.js +3 -3
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +4 -3
- package/dist/entrypoints/server.js +11 -10
- package/dist/entrypoints/telegram.js +2 -2
- package/dist/entrypoints/testing.js +7 -6
- package/dist/entrypoints/tools/connections.js +3 -2
- package/dist/entrypoints/tools/contract.js +1 -1
- package/dist/entrypoints/tools/invoker.js +5 -4
- package/dist/entrypoints/tools/mcp.js +7 -6
- package/dist/entrypoints/tools.js +17 -15
- package/dist/entrypoints/tracking/contract.js +5 -3
- package/dist/entrypoints/tracking/performance.js +3 -3
- package/dist/entrypoints/tracking.d.ts +1 -1
- package/dist/entrypoints/tracking.d.ts.map +1 -1
- package/dist/entrypoints/tracking.js +63 -83
- package/dist/entrypoints/xlsx.js +1 -1
- package/dist/geo/index.d.ts +2 -1
- package/dist/geo/index.d.ts.map +1 -1
- package/dist/geo/record.d.ts +8 -0
- package/dist/geo/record.d.ts.map +1 -0
- package/dist/geo/resolver.d.ts +1 -3
- package/dist/geo/resolver.d.ts.map +1 -1
- package/dist/geo/schema.d.ts +44 -0
- package/dist/geo/schema.d.ts.map +1 -0
- package/dist/geo/types.d.ts +2 -13
- package/dist/geo/types.d.ts.map +1 -1
- package/dist/{index-n5sv4z0w.js → index-1k18qzqa.js} +13 -15
- package/dist/{index-tsngj2b5.js → index-2dfvv1jg.js} +206 -206
- package/dist/{index-d9hq291n.js → index-4jpykzvw.js} +70 -81
- package/dist/{index-ghtpfz4z.js → index-57gqaq8b.js} +2 -2
- package/dist/index-69t14s4a.js +39 -0
- package/dist/{index-6p3frkv5.js → index-6a69xzrx.js} +4 -4
- package/dist/{index-dky0dcmf.js → index-72r9k0av.js} +6 -2
- package/dist/{index-vv1sch8a.js → index-8vzh5wpv.js} +13 -8
- package/dist/{index-xx1j310k.js → index-8yxgcyt6.js} +171 -169
- package/dist/{index-p6apg0jg.js → index-9frf01t9.js} +16 -9
- package/dist/{index-q0th8q0z.js → index-9mjrnqxs.js} +1 -3
- package/dist/{index-ega3yz4c.js → index-aqwg2dm5.js} +1 -1
- package/dist/{index-073nw9qr.js → index-ba7are04.js} +524 -522
- package/dist/{index-095ya5hm.js → index-bbvc59gw.js} +13 -11
- package/dist/{index-txg1npmg.js → index-cyxp8rbf.js} +1 -1
- package/dist/index-d3xdyjt6.js +38 -0
- package/dist/{index-n8z3rvzw.js → index-f4njz9j0.js} +3 -5
- package/dist/{index-90p34rts.js → index-fcqj44mb.js} +3 -1
- package/dist/{index-86nbfysb.js → index-ff39f9dr.js} +3 -3
- package/dist/{index-75ns2ybj.js → index-fqd4yqwd.js} +1 -1
- package/dist/{index-nqxrm176.js → index-g444vfz2.js} +1 -1
- package/dist/{index-vwhrnp67.js → index-kz9734jc.js} +3 -3
- package/dist/{index-dr3t5n1v.js → index-nn9qvkww.js} +46 -46
- package/dist/{index-qezhmp51.js → index-nz06qw5a.js} +3 -1
- package/dist/{index-1bx1xv1k.js → index-pfvde2fz.js} +5 -2
- package/dist/{index-s80awwsw.js → index-qch1vcaa.js} +3 -1
- package/dist/{index-cycp3r3e.js → index-rxcgp4b9.js} +2 -2
- package/dist/{index-w7jq3fz9.js → index-s0qjs6ee.js} +1198 -1196
- package/dist/{index-p0rf7sq9.js → index-s20s2mad.js} +209 -209
- package/dist/{index-v6vb5qx8.js → index-s3yxw6kt.js} +1 -1
- package/dist/{index-cqmqyjax.js → index-sa99p98w.js} +1 -1
- package/dist/{index-0gxvns6s.js → index-sba3e6m4.js} +1 -0
- package/dist/{index-f24bdt13.js → index-v1swr26p.js} +3 -1
- package/dist/{index-rhzkndr5.js → index-x4p3kw1p.js} +533 -530
- package/dist/{index-hdjmdwsj.js → index-x8d9fdeg.js} +513 -507
- package/dist/{index-htxh46ej.js → index-ycqhyars.js} +2 -2
- package/dist/{index-9bwcthxw.js → index-yj6saztf.js} +31 -13
- package/dist/{index-tdpmfks8.js → index-ynrf908v.js} +1 -1
- package/dist/{index-f6m4c545.js → index-zrdcmg6j.js} +4 -6
- package/dist/process/bun-child.d.ts +3 -2
- package/dist/process/bun-child.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-canonical-types.d.ts +1 -1
- package/dist/tracking/attribution.d.ts +21 -25
- package/dist/tracking/attribution.d.ts.map +1 -1
- package/dist/tracking/client-visit.d.ts +5 -7
- package/dist/tracking/client-visit.d.ts.map +1 -1
- package/dist/tracking/client.d.ts +2 -2
- package/dist/tracking/client.d.ts.map +1 -1
- package/dist/tracking/contract.d.ts +1 -1
- package/dist/tracking/host.d.ts +0 -1
- package/dist/tracking/host.d.ts.map +1 -1
- package/dist/tracking/privacy.d.ts +6 -0
- package/dist/tracking/privacy.d.ts.map +1 -1
- package/dist/tracking/schemas.d.ts +2 -2
- package/dist/tracking/schemas.d.ts.map +1 -1
- package/llms/contract.txt +46 -24
- package/llms/geo-contract.txt +23 -0
- package/llms/geo.txt +40 -4
- package/llms/stitchkit.txt +4 -3
- package/llms/tools.2.txt +2 -2
- package/llms/tools.3.txt +1 -1
- package/llms/tracking-contract.txt +1 -1
- package/llms/tracking.txt +27 -5
- package/llms/{upgrading-0.105.0-0.118.0.txt → upgrading-0.106.0-0.119.0.txt} +121 -410
- package/llms/upgrading-0.37.0-0.53.0.txt +969 -0
- package/llms/{upgrading-0.44.0-0.62.0.txt → upgrading-0.55.0-0.68.0.txt} +509 -528
- package/llms/{upgrading-0.63.0-0.83.0.txt → upgrading-0.69.0-0.95.0.txt} +506 -509
- package/llms/{upgrading-0.84.0-0.104.0.txt → upgrading-0.96.0-0.105.0.txt} +410 -506
- package/llms/upgrading.txt +5 -5
- package/llms-full.txt +247 -38
- package/llms.txt +10 -9
- package/package.json +23 -19
- package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
mergeSchemas,
|
|
4
4
|
assertToolExtensionCompatible,
|
|
5
5
|
projectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-x4p3kw1p.js";
|
|
7
7
|
import {
|
|
8
8
|
toolErrorFromResult,
|
|
9
9
|
executeToolMethod
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-s3yxw6kt.js";
|
|
11
11
|
import {
|
|
12
12
|
isRetryableStatus2
|
|
13
13
|
} from "./index-qcn84byh.js";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExposureSchema,
|
|
3
|
+
isHttpOnlyEndpoint
|
|
4
|
+
} from "./index-69t14s4a.js";
|
|
1
5
|
import {
|
|
2
6
|
defineContract2
|
|
3
|
-
} from "./index-
|
|
7
|
+
} from "./index-4jpykzvw.js";
|
|
4
8
|
import {
|
|
5
9
|
bytesToBase64Url,
|
|
6
10
|
base64UrlToBytes
|
|
@@ -119,7 +123,15 @@ function defineErrors2(source, mapping) {
|
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
// src/contract/factory.ts
|
|
122
|
-
|
|
126
|
+
import { z as z2 } from "zod";
|
|
127
|
+
var ContractFactoryToolExposureSchema = z2.strictObject({ default: ExposureSchema });
|
|
128
|
+
var ContractFactoryConfigSchema = z2.strictObject({
|
|
129
|
+
toolExposure: ContractFactoryToolExposureSchema
|
|
130
|
+
});
|
|
131
|
+
function createContractFactory2(...args) {
|
|
132
|
+
if (args.length !== 0) {
|
|
133
|
+
throw new TypeError("createContractFactory takes no arguments; use createContractFactory<Scope>().configure({ toolExposure: { default: [...] } })");
|
|
134
|
+
}
|
|
123
135
|
const scoped = (meta, endpoints) => {
|
|
124
136
|
const validated = defineContract2({ prefix: meta.prefix }, endpoints);
|
|
125
137
|
return {
|
|
@@ -127,20 +139,26 @@ function createContractFactory2(config) {
|
|
|
127
139
|
meta: { ...meta, prefix: meta.prefix, scope: meta.scope }
|
|
128
140
|
};
|
|
129
141
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
function configure(config) {
|
|
143
|
+
const defaults = ContractFactoryConfigSchema.parse(config).toolExposure.default;
|
|
144
|
+
const httpDefaults = Object.freeze(defaults.filter((transport) => transport === "HTTP"));
|
|
145
|
+
const configured = (meta, endpoints) => {
|
|
146
|
+
const materialized = mapObjectTypeBoundary(endpoints, (_key, endpoint) => endpoint.expose !== undefined ? endpoint : {
|
|
147
|
+
...endpoint,
|
|
148
|
+
expose: isHttpOnlyEndpoint(endpoint) ? httpDefaults : defaults
|
|
149
|
+
});
|
|
150
|
+
return scoped(meta, materialized);
|
|
151
|
+
};
|
|
152
|
+
return { defineContract: configured };
|
|
153
|
+
}
|
|
154
|
+
return { defineContract: scoped, configure };
|
|
137
155
|
}
|
|
138
156
|
// src/contract/pagination.ts
|
|
139
|
-
import { z as
|
|
157
|
+
import { z as z3 } from "zod";
|
|
140
158
|
function paginatedSchema2(itemSchema) {
|
|
141
|
-
return
|
|
142
|
-
items:
|
|
143
|
-
nextCursor:
|
|
159
|
+
return z3.object({
|
|
160
|
+
items: z3.array(itemSchema),
|
|
161
|
+
nextCursor: z3.string().nullable()
|
|
144
162
|
});
|
|
145
163
|
}
|
|
146
164
|
function toBase64Url(str) {
|
|
@@ -153,11 +153,6 @@ class NativeCommandError2 extends Error {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
// src/process/owner-loss-guard.ts
|
|
157
|
-
import { spawn } from "node:child_process";
|
|
158
|
-
import { Socket } from "node:net";
|
|
159
|
-
import { fileURLToPath } from "node:url";
|
|
160
|
-
|
|
161
156
|
// src/process/bun-child.ts
|
|
162
157
|
import { EventEmitter } from "node:events";
|
|
163
158
|
import { Readable, Writable } from "node:stream";
|
|
@@ -335,7 +330,7 @@ function defineBunChildren() {
|
|
|
335
330
|
this.#subprocess = subprocess;
|
|
336
331
|
subprocess.exited.then(() => {
|
|
337
332
|
this.exitCode = subprocess.exitCode;
|
|
338
|
-
this.signalCode = subprocess.signalCode;
|
|
333
|
+
this.signalCode = subprocess.signalCode === null ? null : String(subprocess.signalCode);
|
|
339
334
|
this.emit("exit", this.exitCode, this.signalCode);
|
|
340
335
|
for (const pipe of this.pipes)
|
|
341
336
|
if (pipe.readableFlowing === null)
|
|
@@ -488,6 +483,9 @@ function spawnBunGuardTarget(executable, args) {
|
|
|
488
483
|
}
|
|
489
484
|
|
|
490
485
|
// src/process/owner-loss-guard.ts
|
|
486
|
+
import { spawn } from "node:child_process";
|
|
487
|
+
import { Socket } from "node:net";
|
|
488
|
+
import { fileURLToPath } from "node:url";
|
|
491
489
|
var FORWARDED_SIGNALS = [
|
|
492
490
|
"SIGTERM",
|
|
493
491
|
"SIGINT",
|
|
@@ -5,7 +5,8 @@ import { type OwnerLossGuardInvocation } from './owner-loss-protocol.js';
|
|
|
5
5
|
export interface OwnedChild extends EventEmitter {
|
|
6
6
|
readonly pid?: number;
|
|
7
7
|
readonly exitCode: number | null;
|
|
8
|
-
|
|
8
|
+
/** A signal's name, or its decimal number when it has none (a Linux real-time signal). */
|
|
9
|
+
readonly signalCode: string | null;
|
|
9
10
|
readonly stdin: Writable;
|
|
10
11
|
readonly stdout: Readable;
|
|
11
12
|
readonly stderr: Readable;
|
|
@@ -15,7 +16,7 @@ export interface OwnedChild extends EventEmitter {
|
|
|
15
16
|
export interface ObservableChild extends EventEmitter {
|
|
16
17
|
readonly pid?: number;
|
|
17
18
|
readonly exitCode: number | null;
|
|
18
|
-
readonly signalCode:
|
|
19
|
+
readonly signalCode: string | null;
|
|
19
20
|
kill(signal: NodeJS.Signals): boolean;
|
|
20
21
|
}
|
|
21
22
|
interface BunSpawnInput {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun-child.d.ts","sourceRoot":"","sources":["../../src/process/bun-child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,uBAAuB,CAAC;AAG7F,gGAAgG;AAChG,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bun-child.d.ts","sourceRoot":"","sources":["../../src/process/bun-child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,uBAAuB,CAAC;AAG7F,gGAAgG;AAChG,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CACvC;AAED,oEAAoE;AACpE,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CACvC;AAED,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAuKD,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAgD9D;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAsC5E;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACnC;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,cAAc,CAMhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-method.d.ts","sourceRoot":"","sources":["../../src/server/contract-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"contract-method.d.ts","sourceRoot":"","sources":["../../src/server/contract-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAInE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,uFAAuF;AACvF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,oBAAoB,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EACrB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,WAAW,GACpB,oBAAoB,CA+CtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-projector.d.ts","sourceRoot":"","sources":["../../../src/tools/internal/surface-projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAK,MAAM,KAAK,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"surface-projector.d.ts","sourceRoot":"","sources":["../../../src/tools/internal/surface-projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAK,MAAM,KAAK,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAUhE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB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AAQ,SAAS,4BAA4B,EAClF,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC5B,sBAAsB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CA6BjD;AAeD,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,KAAK,EAC5C,KAAK,EAAE,SAAS,sBAAsB,CAAC,KAAK,CAAC,EAAE,EAC/C,MAAM,GAAE,8BAAmC,GAC1C,wBAAwB,CAAC,KAAK,CAAC,EAAE,CA8GnC"}
|
|
@@ -77,7 +77,7 @@ export interface AsyncOperationContractBaseConfig<TStartInput extends ZodType, T
|
|
|
77
77
|
*
|
|
78
78
|
* It has to be declarable HERE because this contract is built inside the
|
|
79
79
|
* framework: an application that made tools opt-in with
|
|
80
|
-
* `createContractFactory({ toolExposure: '
|
|
80
|
+
* `createContractFactory<Scope>().configure({ toolExposure: { default: ['HTTP'] } })` set that default on
|
|
81
81
|
* its OWN factory, and these endpoints never pass through it. Without this
|
|
82
82
|
* field a consumer who had decided that agents get only the tools it names
|
|
83
83
|
* was still handed `start` and `cancel` — both effectful — with no way to say
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import type { AttributionData, UtmData } from './schemas.js';
|
|
2
|
-
/** A referrer hostname pattern and the source/medium it stands for. */
|
|
3
|
-
export interface ReferrerRule {
|
|
4
|
-
pattern: RegExp;
|
|
5
|
-
source: string;
|
|
6
|
-
medium: string;
|
|
7
|
-
}
|
|
8
2
|
export interface AttributionStorage {
|
|
9
3
|
getItem(key: string): string | null;
|
|
10
4
|
setItem(key: string, value: string): void;
|
|
@@ -17,16 +11,8 @@ export interface ResolveAttributionInput {
|
|
|
17
11
|
referrer: string;
|
|
18
12
|
/** `location.pathname`. */
|
|
19
13
|
pathname: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
storage: AttributionStorage;
|
|
23
|
-
/**
|
|
24
|
-
* Which referrer hosts map to a named source and medium. The framework has
|
|
25
|
-
* no built-in list: which hosts count as "social" or "organic" is the
|
|
26
|
-
* application's data (ADR 0002). An unmatched external referrer is
|
|
27
|
-
* `{ source: hostname, medium: 'referral' }`.
|
|
28
|
-
*/
|
|
29
|
-
referrerMap?: readonly ReferrerRule[];
|
|
14
|
+
storage: AttributionStorage | null;
|
|
15
|
+
clickIdParams?: readonly string[];
|
|
30
16
|
/** Storage key. Default `tracking.attribution`. */
|
|
31
17
|
storageKey?: string;
|
|
32
18
|
/** How long first-touch lives. Default 90 days. */
|
|
@@ -35,17 +21,27 @@ export interface ResolveAttributionInput {
|
|
|
35
21
|
}
|
|
36
22
|
export interface ResolvedAttribution {
|
|
37
23
|
firstTouch: AttributionData;
|
|
38
|
-
|
|
24
|
+
/** This page's touch: its landing path is always known. */
|
|
25
|
+
currentTouch: AttributionData & {
|
|
26
|
+
landingPage: string;
|
|
27
|
+
};
|
|
39
28
|
}
|
|
40
29
|
export declare function parseUtmFromSearch(search: string): UtmData | null;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
/** Refuse a click-marker list no request could carry; a client checks it once, at creation. */
|
|
31
|
+
export declare function assertClickIdParams(names: readonly string[]): void;
|
|
32
|
+
/**
|
|
33
|
+
* A referrer as tracking keeps it: credentials masked, and the value of every
|
|
34
|
+
* configured click marker masked too — a referrer from the same site carries the
|
|
35
|
+
* landing query, click identifier included, in full.
|
|
36
|
+
*/
|
|
37
|
+
export declare function trackedReferrer(referrer: string, clickIdParams: readonly string[]): string;
|
|
45
38
|
/**
|
|
46
|
-
* First-touch is written once and lives `ttlMs`;
|
|
47
|
-
*
|
|
48
|
-
*
|
|
39
|
+
* First-touch is written once and lives `ttlMs`; current-touch carries only
|
|
40
|
+
* this page's UTM, referrer and configured click marker. Channel classification
|
|
41
|
+
* and retaining a last non-direct channel belong to the application.
|
|
42
|
+
*
|
|
43
|
+
* Both touches leave here already masked: credentials in the landing path and
|
|
44
|
+
* the referrer ({@link trackedReferrer}), click marker values in the referrer.
|
|
49
45
|
*/
|
|
50
|
-
export declare function resolveAttribution({ search, referrer, pathname,
|
|
46
|
+
export declare function resolveAttribution({ search, referrer, pathname, storage, clickIdParams, storageKey, ttlMs, now, }: ResolveAttributionInput): ResolvedAttribution;
|
|
51
47
|
//# sourceMappingURL=attribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../../src/tracking/attribution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../../src/tracking/attribution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,eAAe,CAAC;IAC5B,2DAA2D;IAC3D,YAAY,EAAE,eAAe,GAAG;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AA6DD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAWjE;AAED,+FAA+F;AAC/F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAMlE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE1F;AAgDD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAkB,EAClB,UAAmC,EACnC,KAAgC,EAChC,GAAgB,GACjB,EAAE,uBAAuB,GAAG,mBAAmB,CAe/C"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* The visit and the outbox of one tab: opening (or renewing) the visit lease,
|
|
3
3
|
* and flushing the outbox one batch at a time under its flush lease.
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type ResolvedAttribution } from './attribution.js';
|
|
6
6
|
import type { Draft } from './client.js';
|
|
7
7
|
import { deliverTrackingBatch } from './delivery.js';
|
|
8
8
|
import type { TrackingHost } from './host.js';
|
|
9
9
|
import type { TrackingOutbox, TrackingQueuedEvent } from './outbox.js';
|
|
10
|
-
import type { TrackEventsRequest, TrackEventsResponse, TrackingEventEnvelope,
|
|
10
|
+
import type { TrackEventsRequest, TrackEventsResponse, TrackingEventEnvelope, VisitBootstrapResponse, VisitEntryContext } from './schemas.js';
|
|
11
11
|
import { createSequenceReserve } from './sequence-reserve.js';
|
|
12
12
|
/** What one tab knows about its visit, shared by bootstrap, delivery and the unload path. */
|
|
13
13
|
export interface VisitState {
|
|
@@ -27,7 +27,7 @@ export interface VisitBootstrapDeps {
|
|
|
27
27
|
readonly host: TrackingHost;
|
|
28
28
|
readonly outbox: TrackingOutbox<TrackingEventEnvelope<string>> | undefined;
|
|
29
29
|
readonly sequences: ReturnType<typeof createSequenceReserve>;
|
|
30
|
-
captureAttribution(search: string, pathname: string): ResolvedAttribution
|
|
30
|
+
captureAttribution(search: string, pathname: string): ResolvedAttribution;
|
|
31
31
|
readonly fail: Fail;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -45,11 +45,9 @@ export declare function createOutboxFlusher<TEvent extends TrackingQueuedEvent>(
|
|
|
45
45
|
}): () => Promise<void>;
|
|
46
46
|
/** The shared sequence source is the outbox; without one, the per-tab fallback is the design. */
|
|
47
47
|
export declare function createVisitSequences(outbox: Pick<TrackingOutbox, 'reserveSequences'> | undefined, visit: VisitState, options: Parameters<typeof createSequenceReserve>[1], fail: (what: string, error: unknown) => void): import("./sequence-reserve.js").SequenceReserve;
|
|
48
|
-
|
|
49
|
-
export declare function redactedUtm(utm: UtmData): UtmData;
|
|
50
|
-
export declare function pageAttribution(host: TrackingHost, storage: NonNullable<TrackingHost['storage']>, referrerMap: readonly ReferrerRule[] | undefined, search: string, pathname: string): ResolvedAttribution;
|
|
48
|
+
export declare function pageAttribution(host: TrackingHost, clickIdParams: readonly string[] | undefined, search: string, pathname: string): ResolvedAttribution;
|
|
51
49
|
/** A page view; the referrer belongs to the first view of the visit only. */
|
|
52
|
-
export declare function pageViewDraft<TType extends string>(host: TrackingHost, type: TType, pathname: string, previous: string | null): Draft<TType>;
|
|
50
|
+
export declare function pageViewDraft<TType extends string>(host: TrackingHost, type: TType, pathname: string, previous: string | null, clickIdParams: readonly string[] | undefined): Draft<TType>;
|
|
53
51
|
/** Give every draft its identity, refilling the sequence pool once when it runs dry. */
|
|
54
52
|
export declare function materializeAll<TType extends string, TEvent>(drafts: readonly Draft<TType>[], materialize: (draft: Draft<TType>) => TEvent | null, sequences: {
|
|
55
53
|
refill(): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-visit.d.ts","sourceRoot":"","sources":["../../src/tracking/client-visit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"client-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,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAUrB;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,KAAK,SAAS,MAAM,EAChD,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAC3C,KAAK,CAAC,KAAK,CAAC,CAgBd;AAED,wFAAwF;AACxF,wBAAsB,cAAc,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,EAC/D,MAAM,EAAE,SAAS,KAAK,CAAC,KAAK,CAAC,EAAE,EAC/B,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,MAAM,GAAG,IAAI,EACnD,SAAS,EAAE;IAAE,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,GACxC,OAAO,CAAC,MAAM,EAAE,CAAC,CAWnB;AAED,qGAAqG;AACrG,wBAAsB,oBAAoB,CAAC,MAAM,SAAS,qBAAqB,CAAC,MAAM,CAAC,EACrF,MAAM,EAAE;IACN,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC3E,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAC/E,EACD,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACnC,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAUrC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* application supplies — HTTP, a socket first), the React wrapper, the
|
|
12
12
|
* session. → ADR 0166.
|
|
13
13
|
*/
|
|
14
|
-
import
|
|
14
|
+
import { type ResolvedAttribution } from './attribution.js';
|
|
15
15
|
import type { ResolveTrackedClickOptions, TrackedClickAttributes } from './clicks.js';
|
|
16
16
|
import type { TrackingHost } from './host.js';
|
|
17
17
|
import type { TrackingOutbox } from './outbox.js';
|
|
@@ -86,7 +86,7 @@ export interface TrackingClientConfig<TMetadata extends object, TEvent extends T
|
|
|
86
86
|
onFailure?: (what: string, error: unknown) => void;
|
|
87
87
|
/** Whether an interaction name is one the application knows. Default: any. */
|
|
88
88
|
isAction?: (action: string) => boolean;
|
|
89
|
-
|
|
89
|
+
clickIdParams?: readonly string[];
|
|
90
90
|
clickAttributes?: TrackedClickAttributes;
|
|
91
91
|
/** Click URL retention before `decorate`. Default `path-only`; `full` includes query/fragment. */
|
|
92
92
|
hrefPolicy?: ResolveTrackedClickOptions['hrefPolicy'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tracking/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tracking/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAYnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAInB,wFAAwF;AACxF,MAAM,WAAW,yBAAyB,CAAC,KAAK,SAAS,MAAM;IAC7D,QAAQ,EAAE,KAAK,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,KAAK,CA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M,CAAC;IACrB,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD;AAED,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM;IACtD,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,sFAAsF;IACtF,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,yEAAyE;IACzE,KAAK,IAAI,MAAM,IAAI,CAAC;IACpB,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IACjC,8FAA8F;IAC9F,WAAW,IAAI,mBAAmB,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,MAAM,KAAK,CAAC,KAAK,SAAS,MAAM,IAAI,IAAI,CAC5C,qBAAqB,CAAC,KAAK,CAAC,EAC5B,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,iBAAiB,CAC9D,CAAC;AAqCF,wBAAgB,oBAAoB,CAClC,SAAS,SAAS,MAAM,EACxB,MAAM,SAAS,qBAAqB,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,qBAAqB,CACpF,MAAM,SAAS,GAAG,MAAM,CACzB,EACD,MAAM,EAAE,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CA0L5E"}
|
|
@@ -45,7 +45,7 @@ export type TrackingContractEndpoints<TSchemas extends TrackingSchemas<z.ZodObje
|
|
|
45
45
|
* **Both endpoints are HTTP-only, and that is not a formality.** An endpoint
|
|
46
46
|
* with no `expose` is a tool on MCP and AGENT by default, and this contract is
|
|
47
47
|
* built here rather than by the application's own contract factory — so a
|
|
48
|
-
* project that sets `
|
|
48
|
+
* project that sets a factory default of `['HTTP']` for everything it authors was
|
|
49
49
|
* still handed a `track` tool it never asked for. An agent has nothing to gain
|
|
50
50
|
* from a browser-event ingest and one thing to lose by having it: writes into
|
|
51
51
|
* the application's visitor data, under its own name, indistinguishable
|
package/dist/tracking/host.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/tracking/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/tracking/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,SAAS,GAAG,YAAY,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,mBAAmB,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC;IACnB,mCAAmC;IACnC,WAAW,IAAI,MAAM,CAAC;IACtB,0CAA0C;IAC1C,EAAE,CACA,KAAK,EAAE,UAAU,GAAG,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,EAC5D,OAAO,EAAE,MAAM,IAAI,GAClB,MAAM,IAAI,CAAC;IACd,2EAA2E;IAC3E,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;IACtD,2BAA2B;IAC3B,GAAG,IAAI,MAAM,CAAC;IACd,SAAS,IAAI,MAAM,CAAC;IACpB,UAAU,IAAI,MAAM,CAAC;IACrB,6DAA6D;IAC7D,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACpC;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,IAAI,YAAY,CAkDlD"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** Mask secrets in a URL, a query string or free text, cut to 16 KiB. */
|
|
2
2
|
export declare function redactTrackingText(input: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Mask the values of the named parameters wherever they appear in a URL — the
|
|
5
|
+
* click markers an application recognises, whose value identifies one click.
|
|
6
|
+
* Names match exactly, as `URLSearchParams` reads them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function maskTrackingParameters(input: string, names: ReadonlySet<string>): string;
|
|
3
9
|
/** The same rule through a value of any shape: a secret key masks whatever it holds. */
|
|
4
10
|
export declare function redactTrackingValue(value: unknown): unknown;
|
|
5
11
|
//# sourceMappingURL=privacy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/tracking/privacy.ts"],"names":[],"mappings":"AA0FA,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBxD;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAY3D"}
|
|
1
|
+
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/tracking/privacy.ts"],"names":[],"mappings":"AA0FA,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBxD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAKxF;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAY3D"}
|
|
@@ -22,6 +22,7 @@ export declare const AttributionDataSchema: z.ZodObject<{
|
|
|
22
22
|
content: z.ZodOptional<z.ZodString>;
|
|
23
23
|
term: z.ZodOptional<z.ZodString>;
|
|
24
24
|
}, z.core.$strip>>;
|
|
25
|
+
clickId: z.ZodOptional<z.ZodString>;
|
|
25
26
|
referrer: z.ZodOptional<z.ZodString>;
|
|
26
27
|
landingPage: z.ZodOptional<z.ZodString>;
|
|
27
28
|
}, z.core.$strip>;
|
|
@@ -117,7 +118,6 @@ export interface TrackingEventEnvelope<TType extends string = string> {
|
|
|
117
118
|
export interface TrackEventsRequest<TEvent extends TrackingEventEnvelope = TrackingEventEnvelope> {
|
|
118
119
|
buildId: string;
|
|
119
120
|
events: TEvent[];
|
|
120
|
-
utm?: UtmData;
|
|
121
121
|
}
|
|
122
122
|
declare function visitEntryContextShape(buildIdPattern: RegExp): {
|
|
123
123
|
browserStreamId: z.ZodUUID;
|
|
@@ -132,6 +132,7 @@ declare function visitEntryContextShape(buildIdPattern: RegExp): {
|
|
|
132
132
|
content: z.ZodOptional<z.ZodString>;
|
|
133
133
|
term: z.ZodOptional<z.ZodString>;
|
|
134
134
|
}, z.core.$strip>>;
|
|
135
|
+
clickId: z.ZodOptional<z.ZodString>;
|
|
135
136
|
displayMode: z.ZodEnum<{
|
|
136
137
|
browser: "browser";
|
|
137
138
|
standalone: "standalone";
|
|
@@ -164,7 +165,6 @@ export interface TrackingSchemas<TEvent extends z.ZodObject> {
|
|
|
164
165
|
request: z.ZodObject<{
|
|
165
166
|
buildId: z.ZodString;
|
|
166
167
|
events: z.ZodArray<TEvent>;
|
|
167
|
-
utm: z.ZodOptional<typeof UtmDataSchema>;
|
|
168
168
|
}>;
|
|
169
169
|
response: typeof TrackEventsResponseSchema;
|
|
170
170
|
disposition: typeof TrackingDispositionSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tracking/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AACjF,eAAO,MAAM,aAAa;;;;;;iBAMxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tracking/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AACjF,eAAO,MAAM,aAAa;;;;;;iBAMxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,qBAAqB;;;;;;;;;;;iBAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM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W,eAAe,CAAC,MAAM,SAAS,CAAC,CAAC,SAAS;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;QACnB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC5B,CAAC,CAAC;IACH,QAAQ,EAAE,OAAO,yBAAyB,CAAC;IAC3C,WAAW,EAAE,OAAO,yBAAyB,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC3C,SAAS,EAAE,OAAO,4BAA4B,CAAC;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,EACxD,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,GAC9C,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3D,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,EAAE,OAAO,SAAS,CAAC,CAAC,WAAW,EACvF,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,GAC5C,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC"}
|
package/llms/contract.txt
CHANGED
|
@@ -176,33 +176,55 @@ tools. Narrow it with `expose`:
|
|
|
176
176
|
|
|
177
177
|
- `expose: ['HTTP']` — HTTP only. The endpoint never becomes a tool.
|
|
178
178
|
- `expose: ['MCP', 'AGENT']` — a tool only; no HTTP route.
|
|
179
|
-
-
|
|
179
|
+
- `expose: []` — no transport; the endpoint stays hidden.
|
|
180
|
+
- omit `expose` — HTTP, MCP and AGENT; CLI is opt-in.
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
Choose an application's default surface at its scoped factory. Scope and policy
|
|
183
|
+
are inferred in separate calls, so the returned endpoint types retain exact transports:
|
|
183
184
|
|
|
184
185
|
```ts
|
|
185
|
-
const { defineContract } = createContractFactory<AppScope>({
|
|
186
|
-
toolExposure: '
|
|
186
|
+
const { defineContract } = createContractFactory<AppScope>().configure({
|
|
187
|
+
toolExposure: { default: ['HTTP', 'CLI'] },
|
|
187
188
|
})
|
|
188
189
|
```
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
endpoint
|
|
192
|
-
|
|
191
|
+
An omitted `expose` (including `undefined`) materializes this array on the returned
|
|
192
|
+
endpoint before validation. An explicit endpoint array **replaces** it, never merges
|
|
193
|
+
with it: `['HTTP']` stays HTTP-only, `['MCP']` enables only MCP, and `[]` hides the
|
|
194
|
+
operation everywhere. Types, HTTP routes, typed clients, tools, CLI, OpenAPI and
|
|
195
|
+
transport summaries read that same materialized exposure.
|
|
193
196
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
HTTP client methods and URL builders require a **guaranteed** HTTP transport:
|
|
198
|
+
pass a literal policy array directly to `configure` so its const generic infers
|
|
199
|
+
the tuple. A stored array, even with `satisfies ContractFactoryConfig`, can widen
|
|
200
|
+
to `Transport[]` and contain no HTTP at runtime,
|
|
201
|
+
so it does not promise an HTTP method. Optional capabilities preserve both
|
|
202
|
+
possible effective exposures rather than claiming an unfiltered default tuple.
|
|
198
203
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
[
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
The same holds for an endpoint whose own type is broad, with or without a factory:
|
|
205
|
+
a value annotated as `EndpointDef` or `FactoryScopedEndpoint<Scope>` carries
|
|
206
|
+
`expose?: readonly Transport[]`, which may hold no HTTP, so it has no client method
|
|
207
|
+
or URL. A helper that builds endpoints keeps their literal type with a const generic:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
const endpoint = <const Endpoint extends FactoryScopedEndpoint<AppScope>>(value: Endpoint) => value
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
For a curated tool surface use `toolExposure: { default: ['HTTP'] }`, then name
|
|
214
|
+
tool transports only on endpoints that intentionally join them. An empty default
|
|
215
|
+
is legal. Each `configure` snapshots its array independently; it does not change
|
|
216
|
+
the base factory, sibling configurations or authored endpoints. The no-config
|
|
217
|
+
factory and plain `defineContract` keep the default-on behaviour above.
|
|
218
|
+
|
|
219
|
+
Six intrinsic HTTP-only forms intersect an **implicit factory default** with HTTP:
|
|
220
|
+
`multipart`, [`rawResponse`](./server.md#raw-response-endpoints),
|
|
221
|
+
[`responseMeta`](./server.md#typed-json-response-metadata), `rawBody`, streaming
|
|
222
|
+
responses and `HEAD`. Under `['HTTP', 'CLI']` they receive `['HTTP']`; under
|
|
223
|
+
`['CLI']` or `[]` they receive `[]`, not an implicitly reopened HTTP route.
|
|
224
|
+
An **explicit** non-HTTP exposure on any of them is a definition error, not a
|
|
225
|
+
silent downgrade. `safelistedBody` only changes HTTP parsing and remains
|
|
226
|
+
multi-transport. A factory policy applies only to contracts authored through
|
|
227
|
+
that factory, not to contracts another helper builds internally.
|
|
206
228
|
|
|
207
229
|
## Tool options (`tool`)
|
|
208
230
|
|
|
@@ -220,7 +242,7 @@ endpoint that can never be a tool (a raw response, a stream, `responseMeta`,
|
|
|
220
242
|
|
|
221
243
|
`expose` stays outside the group: it chooses transports, HTTP included.
|
|
222
244
|
Setting `tool` on an endpoint with no tool transport — `expose: ['HTTP']`, or an
|
|
223
|
-
omitted `expose` under a factory with
|
|
245
|
+
omitted `expose` under a factory with a default containing no tool transport — throws at
|
|
224
246
|
definition time. The pre-0.94 top-level keys (`toolName`, `toolView`, `ui`,
|
|
225
247
|
`annotations`, `mcp`) are refused by name, with where each one went.
|
|
226
248
|
|
|
@@ -504,11 +526,11 @@ from the root `stitchkit`.
|
|
|
504
526
|
| Export | Kind | Summary |
|
|
505
527
|
|--------|------|---------|
|
|
506
528
|
| `defineContract` | function | declare a contract — [guide](../guide/contracts.md#definecontract) |
|
|
529
|
+
| `ConfiguredScopedDefineContract` | _type_ | scoped authoring parameterized by the exact default transport tuple; explicit endpoint exposure replaces it |
|
|
530
|
+
| `ConfiguredToolExposureEndpoints` | _type_ | endpoint map with materialized exposure; a second generic selects defaults (HTTP when omitted), preserving explicit, optional and conditional overrides |
|
|
507
531
|
| `createContractFactory` | function | a `defineContract` whose scope — on the contract **and** on any endpoint override — is required and held to your union, retaining each concrete literal — [guide](../guide/contracts.md#scope) |
|
|
508
|
-
| `ContractFactoryConfig` | _type_ |
|
|
509
|
-
| `ContractFactoryToolExposure` | _type_ | `
|
|
510
|
-
| `ExplicitScopedDefineContract` | _type_ | scoped factory authoring with explicit tool opt-in |
|
|
511
|
-
| `ExplicitToolExposureEndpoints` | _type_ | endpoint map after missing exposure is materialized as `['HTTP']` |
|
|
532
|
+
| `ContractFactoryConfig` | _type_ | configuration passed to `createContractFactory<Scope>().configure({ toolExposure: { default: [...] } })`; the constructor itself takes no arguments |
|
|
533
|
+
| `ContractFactoryToolExposure` | _type_ | `default: readonly Transport[]`; omitted endpoint exposure uses the immutable policy snapshot, intersected with intrinsic HTTP-only capabilities |
|
|
512
534
|
| `FactoryScopedEndpoint` | _type_ | an endpoint authored through the factory — its own `scope` override is held to the same union |
|
|
513
535
|
| `ScopedContractDef` | _type_ | a factory-defined contract whose `meta.scope` is the required concrete literal |
|
|
514
536
|
| `ScopedDefineContract` | _type_ | the `defineContract` `createContractFactory` returns — endpoint `scope` overrides join the union |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# stitchkit/geo/contract — stitchkit docs slice
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
|
|
6
|
+
Contains: API reference: `stitchkit/geo/contract` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
Also read:
|
|
9
|
+
- see `llms/geo.txt` for the GeoIP guide
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# API reference: `stitchkit/geo/contract` (docs/api/reference.md)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
## `stitchkit/geo/contract`
|
|
16
|
+
|
|
17
|
+
The place snapshot's schema, browser-safe, for a shared contract. Brings `zod`.
|
|
18
|
+
|
|
19
|
+
| Export | Kind | Summary |
|
|
20
|
+
|--------|------|---------|
|
|
21
|
+
| `GeoAttributionSchema` / `GeoAttribution` | schema / _type_ | the strict readonly Zod owner of the snapshot `stitchkit/geo` resolves — [guide](../guide/geo.md#lookups) |
|
|
22
|
+
|
|
23
|
+
---
|