@avasapp/agent-bridge 0.1.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/LICENSE +21 -0
- package/README.md +159 -0
- package/dist/adapters/expo-router.cjs +144 -0
- package/dist/adapters/expo-router.d.cts +38 -0
- package/dist/adapters/react-native-mmkv.cjs +102 -0
- package/dist/adapters/react-native-mmkv.d.cts +15 -0
- package/dist/adapters/tanstack-query.cjs +161 -0
- package/dist/adapters/tanstack-query.d.cts +10 -0
- package/dist/adapters/zustand.cjs +97 -0
- package/dist/adapters/zustand.d.cts +15 -0
- package/dist/chunk-UEWFQWCY.js +575 -0
- package/dist/cli.js +657 -0
- package/dist/client/index.cjs +568 -0
- package/dist/client/index.d.ts +112 -0
- package/dist/client/index.js +14 -0
- package/dist/expo/index.cjs +62 -0
- package/dist/expo/index.d.cts +9 -0
- package/dist/network/index.cjs +568 -0
- package/dist/network/index.d.cts +85 -0
- package/dist/noop/expo-router.cjs +26 -0
- package/dist/noop/expo.cjs +27 -0
- package/dist/noop/index.cjs +36 -0
- package/dist/noop/network.cjs +34 -0
- package/dist/noop/react-native-mmkv.cjs +26 -0
- package/dist/noop/tanstack-query.cjs +26 -0
- package/dist/noop/zustand.cjs +26 -0
- package/dist/runtime/index.cjs +933 -0
- package/dist/runtime/index.d.cts +69 -0
- package/dist/types-C6DUUHnB.d.cts +76 -0
- package/entries/expo-router.cjs +9 -0
- package/entries/expo.cjs +9 -0
- package/entries/index.cjs +9 -0
- package/entries/network.cjs +9 -0
- package/entries/react-native-mmkv.cjs +9 -0
- package/entries/tanstack-query.cjs +9 -0
- package/entries/zustand.cjs +9 -0
- package/package.json +120 -0
- package/skills/agent-bridge/SKILL.md +89 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { T as Tools } from '../types-C6DUUHnB.cjs';
|
|
2
|
+
|
|
3
|
+
/** Which requests a mock answers. A bare string is a URL substring. */
|
|
4
|
+
type MockMatch = string | {
|
|
5
|
+
/** A substring of the URL, a RegExp, or `{ regex }` from JSON. */
|
|
6
|
+
url: string | RegExp | {
|
|
7
|
+
regex: string;
|
|
8
|
+
flags?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Any method when left out. */
|
|
11
|
+
method?: string;
|
|
12
|
+
};
|
|
13
|
+
type MockResponse = {
|
|
14
|
+
/** Defaults to 200. */
|
|
15
|
+
status?: number;
|
|
16
|
+
/** Sent as JSON, with a JSON content type. Wins over `body`. */
|
|
17
|
+
json?: unknown;
|
|
18
|
+
body?: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** Fails the way a real network failure does. */
|
|
22
|
+
| {
|
|
23
|
+
offline: true;
|
|
24
|
+
};
|
|
25
|
+
/** What a handler sees of the request. */
|
|
26
|
+
type MockRequest = {
|
|
27
|
+
method: string;
|
|
28
|
+
url: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
body?: string;
|
|
31
|
+
/** The body parsed as JSON, or undefined. */
|
|
32
|
+
json: () => unknown;
|
|
33
|
+
};
|
|
34
|
+
/** Return undefined to let the request through to the next mock or the network. */
|
|
35
|
+
type MockHandler = (request: MockRequest) => MockResponse | undefined | Promise<MockResponse | undefined>;
|
|
36
|
+
type MockOptions = {
|
|
37
|
+
/** Answer this many requests, then remove the mock. */
|
|
38
|
+
times?: number;
|
|
39
|
+
/** Wait before answering. */
|
|
40
|
+
delayMs?: number;
|
|
41
|
+
/** Registering again with the same id replaces the mock (handy with Fast Refresh). */
|
|
42
|
+
id?: string;
|
|
43
|
+
};
|
|
44
|
+
type MockRoute = {
|
|
45
|
+
match: MockMatch;
|
|
46
|
+
response: MockResponse | MockHandler;
|
|
47
|
+
options?: MockOptions;
|
|
48
|
+
};
|
|
49
|
+
type LogEntry = {
|
|
50
|
+
id: number;
|
|
51
|
+
method: string;
|
|
52
|
+
url: string;
|
|
53
|
+
status?: number;
|
|
54
|
+
ms: number;
|
|
55
|
+
pending?: boolean;
|
|
56
|
+
requestBody?: string;
|
|
57
|
+
responseBody?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
mocked?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Starts logging fetch and XMLHttpRequest traffic. Runs once per app; mocks
|
|
64
|
+
* and `networkTools()` call it for you. Metro and Expo dev-server requests are
|
|
65
|
+
* never logged or mocked.
|
|
66
|
+
*/
|
|
67
|
+
declare function installNetwork(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Answers matching requests from the app's own code, e.g. a fake backend.
|
|
70
|
+
* Agent mocks (from `net.mock`) take precedence; `net.restore` keeps these.
|
|
71
|
+
*/
|
|
72
|
+
declare function mock(match: MockMatch, response: MockResponse | MockHandler, options?: MockOptions): {
|
|
73
|
+
id: string;
|
|
74
|
+
remove: () => boolean;
|
|
75
|
+
};
|
|
76
|
+
/** Registers several app mocks. Returns a function that removes them. */
|
|
77
|
+
declare function mockRequests(routes: MockRoute[]): () => void;
|
|
78
|
+
type NetworkToolsOptions = {
|
|
79
|
+
/** Extra URLs never to log or mock: substrings or RegExps. */
|
|
80
|
+
skip?: Array<string | RegExp>;
|
|
81
|
+
};
|
|
82
|
+
/** Read the request log and mock responses: `net.*`. */
|
|
83
|
+
declare function networkTools(options?: NetworkToolsOptions): Tools;
|
|
84
|
+
|
|
85
|
+
export { type LogEntry, type MockHandler, type MockMatch, type MockOptions, type MockRequest, type MockResponse, type MockRoute, type NetworkToolsOptions, installNetwork, mock, mockRequests, networkTools };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/expo-router.ts
|
|
21
|
+
var expo_router_exports = {};
|
|
22
|
+
__export(expo_router_exports, {
|
|
23
|
+
routerTools: () => routerTools
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(expo_router_exports);
|
|
26
|
+
var routerTools = () => ({});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/expo.ts
|
|
21
|
+
var expo_exports = {};
|
|
22
|
+
__export(expo_exports, {
|
|
23
|
+
expoTransport: () => expoTransport
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(expo_exports);
|
|
26
|
+
var expoTransport = () => ({ name: "noop", start: () => () => {
|
|
27
|
+
} });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/index.ts
|
|
21
|
+
var noop_exports = {};
|
|
22
|
+
__export(noop_exports, {
|
|
23
|
+
cdpTransport: () => cdpTransport,
|
|
24
|
+
settle: () => settle,
|
|
25
|
+
startAgentBridge: () => startAgentBridge,
|
|
26
|
+
useAgentBridge: () => useAgentBridge
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(noop_exports);
|
|
29
|
+
var inert = () => ({ name: "noop", start: () => () => {
|
|
30
|
+
} });
|
|
31
|
+
var startAgentBridge = () => () => {
|
|
32
|
+
};
|
|
33
|
+
var useAgentBridge = () => {
|
|
34
|
+
};
|
|
35
|
+
var cdpTransport = inert;
|
|
36
|
+
var settle = () => Promise.resolve({ commits: 0, ms: 0 });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/network.ts
|
|
21
|
+
var network_exports = {};
|
|
22
|
+
__export(network_exports, {
|
|
23
|
+
installNetwork: () => installNetwork,
|
|
24
|
+
mock: () => mock,
|
|
25
|
+
mockRequests: () => mockRequests,
|
|
26
|
+
networkTools: () => networkTools
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(network_exports);
|
|
29
|
+
var installNetwork = () => {
|
|
30
|
+
};
|
|
31
|
+
var mock = () => ({ id: "", remove: () => false });
|
|
32
|
+
var mockRequests = () => () => {
|
|
33
|
+
};
|
|
34
|
+
var networkTools = () => ({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/react-native-mmkv.ts
|
|
21
|
+
var react_native_mmkv_exports = {};
|
|
22
|
+
__export(react_native_mmkv_exports, {
|
|
23
|
+
mmkvTools: () => mmkvTools
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(react_native_mmkv_exports);
|
|
26
|
+
var mmkvTools = () => ({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/tanstack-query.ts
|
|
21
|
+
var tanstack_query_exports = {};
|
|
22
|
+
__export(tanstack_query_exports, {
|
|
23
|
+
queryTools: () => queryTools
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(tanstack_query_exports);
|
|
26
|
+
var queryTools = () => ({});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/noop/zustand.ts
|
|
21
|
+
var zustand_exports = {};
|
|
22
|
+
__export(zustand_exports, {
|
|
23
|
+
storeTools: () => storeTools
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(zustand_exports);
|
|
26
|
+
var storeTools = () => ({});
|