exoagent 0.0.1 → 0.0.3
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 +115 -30
- package/dist/capnweb/index-workers.cjs +2811 -0
- package/dist/capnweb/index-workers.cjs.map +1 -0
- package/dist/capnweb/index-workers.d.cts +2 -0
- package/dist/capnweb/index-workers.d.ts +2 -0
- package/dist/capnweb/index-workers.js +2774 -0
- package/dist/capnweb/index-workers.js.map +1 -0
- package/dist/capnweb/index.cjs +2788 -0
- package/dist/capnweb/index.cjs.map +1 -0
- package/dist/capnweb/index.d.cts +383 -0
- package/dist/capnweb/index.d.ts +383 -0
- package/dist/{code-mode-runtime.mjs → capnweb/index.js} +342 -90
- package/dist/capnweb/index.js.map +1 -0
- package/dist/capnweb-test-helpers.d.ts +25 -0
- package/dist/code-mode-deno.d.ts +13 -0
- package/dist/code-mode-runtime.d.ts +1 -0
- package/dist/code-mode.d.ts +39 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +97 -3391
- package/dist/rpc-toolset-BnC2BXPq.js +146 -0
- package/dist/rpc-toolset-test-helpers.d.mts +11 -2
- package/dist/rpc-toolset-test-helpers.d.ts +45 -0
- package/dist/rpc-toolset-test-helpers.mjs +12 -1371
- package/dist/rpc-toolset.d.ts +34 -0
- package/dist/sql/builder.d.ts +127 -0
- package/dist/sql/expression.d.ts +69 -0
- package/dist/sql/sql.d.ts +4 -0
- package/dist/sql/test-helpers.d.ts +9 -0
- package/dist/sql.d.ts +2 -0
- package/dist/sql.mjs +553 -0
- package/dist/stream-transport.d.ts +11 -0
- package/dist/tool-wrapper.d.ts +16 -0
- package/package.json +26 -12
- package/dist/index.d.mts +0 -426
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import { RpcTarget } from '../packages/capnweb/dist';
|
|
3
|
+
declare const toolMetadataKey: unique symbol;
|
|
4
|
+
type ToolMetadata = {
|
|
5
|
+
[toolMetadataKey]?: {
|
|
6
|
+
runtimeValidationEnabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const setToolMetadata: (target: (...args: any[]) => unknown, metadata: ToolMetadata[typeof toolMetadataKey]) => void;
|
|
10
|
+
declare function toolDef(): <This, Return>(target: (this: This) => Return, context: ClassMethodDecoratorContext<This, (this: This) => Return>) => (this: This) => Return;
|
|
11
|
+
declare function toolDef<TInput>(inputSchema: StandardSchemaV1<TInput, TInput>): <This, Return>(target: (this: This, arg: TInput) => Return, context: ClassMethodDecoratorContext<This, (this: This, arg: TInput) => Return>) => (this: This, arg: TInput) => Return;
|
|
12
|
+
declare function toolUnsafeNoValidation(): <This, Return>(target: (this: This, ...args: any[]) => Return, context: ClassMethodDecoratorContext<This, (...unknown: any[]) => Return>) => any;
|
|
13
|
+
declare const callbackMetadataKey: unique symbol;
|
|
14
|
+
export type ToolCallback<T extends (arg: any) => unknown> = T | {
|
|
15
|
+
[callbackMetadataKey]: {
|
|
16
|
+
callback: T;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type Fn = ToolCallback<(arg: any) => any>;
|
|
20
|
+
declare function callbackTool(): <This, Return>(target: (this: This, arg: Fn) => Return, context: ClassMethodDecoratorContext<This, (this: This, arg: Fn) => Return>) => (this: This, arg: Fn) => Return;
|
|
21
|
+
declare const unwrapCallback: <A, V>(toolCallback: ToolCallback<(arg: A) => V>, returnSchema: StandardSchemaV1<V, V> | ((arg: unknown) => arg is V)) => <R>(arg: A, then: (result: V) => R, opts?: {
|
|
22
|
+
catch?: (error: unknown) => R;
|
|
23
|
+
finally?: () => void;
|
|
24
|
+
}) => R;
|
|
25
|
+
export type ToolAnnotation = typeof toolDef & {
|
|
26
|
+
callback: typeof callbackTool;
|
|
27
|
+
unwrap: typeof unwrapCallback;
|
|
28
|
+
unsafeNoValidation: typeof toolUnsafeNoValidation;
|
|
29
|
+
};
|
|
30
|
+
export declare const tool: ToolAnnotation;
|
|
31
|
+
export declare class RpcToolset extends RpcTarget {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { CompiledQuery, Dialect } from 'kysely';
|
|
2
|
+
import { ToolCallback, RpcToolset } from '../rpc-toolset';
|
|
3
|
+
import { SqlExpressionIn, ColumnReferenceExpression, OrderByValue, SqlExpression } from './expression';
|
|
4
|
+
import { RawSql } from './sql';
|
|
5
|
+
type RowLikeRaw = {
|
|
6
|
+
[key: string]: SqlExpression;
|
|
7
|
+
};
|
|
8
|
+
type RowLikeRawIn = {
|
|
9
|
+
[key: string]: SqlExpressionIn;
|
|
10
|
+
};
|
|
11
|
+
type RowLike = RowLikeRaw | TableBase;
|
|
12
|
+
type RowLikeIn = RowLikeRawIn | RowLike;
|
|
13
|
+
type AsRowLike<R extends RowLikeIn> = R extends TableBase ? R : {
|
|
14
|
+
[key in keyof R]: R[key] extends SqlExpression ? R[key] : SqlExpression;
|
|
15
|
+
};
|
|
16
|
+
type NamespacedExpression<A, R> = (arg: A) => R;
|
|
17
|
+
type FromItem<N extends string, F extends RowLike> = {
|
|
18
|
+
alias: N;
|
|
19
|
+
toRowLike: () => F;
|
|
20
|
+
compile: (opts?: {
|
|
21
|
+
isSubquery?: boolean;
|
|
22
|
+
}) => RawSql;
|
|
23
|
+
onExpression?: SqlExpression;
|
|
24
|
+
};
|
|
25
|
+
export declare const isFromItem: (value: unknown) => value is FromItem<string, RowLike>;
|
|
26
|
+
type TableNamespace = {
|
|
27
|
+
[key: string]: RowLike;
|
|
28
|
+
};
|
|
29
|
+
type OrderByItem<TN extends TableNamespace> = NamespacedExpression<TN, SqlExpression | SqlExpression[] | OrderByValue | OrderByValue[] | (SqlExpression | OrderByValue)[]>;
|
|
30
|
+
type Tables<TN extends TableNamespace> = {
|
|
31
|
+
[k in keyof TN & string]: {
|
|
32
|
+
fromItem: FromItem<k, TN[k]>;
|
|
33
|
+
joinType: 'inner' | 'left' | null;
|
|
34
|
+
on?: SqlExpression;
|
|
35
|
+
isLateral: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
type QueryBuilderParams<N extends string, TN extends TableNamespace, S extends RowLike> = {
|
|
39
|
+
db: Database;
|
|
40
|
+
alias: N;
|
|
41
|
+
tables: Tables<TN>;
|
|
42
|
+
selectRowLike: S;
|
|
43
|
+
whereExpression?: SqlExpression;
|
|
44
|
+
orderByExpressions?: OrderByValue[];
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
rawTable: TableClass<N> | undefined;
|
|
48
|
+
};
|
|
49
|
+
declare class QueryBuilder<N extends string, TN extends TableNamespace, S extends RowLike> extends RpcToolset implements FromItem<N, S> {
|
|
50
|
+
#private;
|
|
51
|
+
readonly alias: N;
|
|
52
|
+
private selectRowLike;
|
|
53
|
+
private tables;
|
|
54
|
+
private whereExpression?;
|
|
55
|
+
private orderByExpressions?;
|
|
56
|
+
private arg;
|
|
57
|
+
private rawTable;
|
|
58
|
+
constructor(params: QueryBuilderParams<N, TN, S>);
|
|
59
|
+
select<S2 extends RowLikeIn>(select: ToolCallback<(arg: TN) => S2>): QueryBuilder<N, TN, AsRowLike<S2>>;
|
|
60
|
+
where(where: ToolCallback<(arg: TN) => SqlExpressionIn>): QueryBuilder<N, TN, S>;
|
|
61
|
+
orderBy(orderBy: ToolCallback<OrderByItem<TN>>): QueryBuilder<N, TN, S>;
|
|
62
|
+
limit(limit: number): QueryBuilder<N, TN, S>;
|
|
63
|
+
offset(offset: number): QueryBuilder<N, TN, S>;
|
|
64
|
+
join<N2 extends string, F2 extends TableClass<N2>>(fromItem: F2 | NamespacedExpression<TN, F2>, on?: NamespacedExpression<TN & {
|
|
65
|
+
[k in N2]: InstanceType<F2>;
|
|
66
|
+
}, SqlExpressionIn>): QueryBuilder<N, TN & {
|
|
67
|
+
[k in N2]: InstanceType<F2>;
|
|
68
|
+
}, S>;
|
|
69
|
+
join<N2 extends string, F2 extends RowLike>(fromItem: FromItem<N2, F2> | NamespacedExpression<TN, FromItem<N2, F2>>, on?: NamespacedExpression<TN & {
|
|
70
|
+
[k in N2]: F2;
|
|
71
|
+
}, SqlExpressionIn>): QueryBuilder<N, TN & {
|
|
72
|
+
[k in N2]: F2;
|
|
73
|
+
}, S>;
|
|
74
|
+
execute(): Promise<{
|
|
75
|
+
results: {
|
|
76
|
+
[key in keyof S]: unknown;
|
|
77
|
+
}[];
|
|
78
|
+
sql?: string;
|
|
79
|
+
parameters?: readonly unknown[];
|
|
80
|
+
}>;
|
|
81
|
+
private paramsForCopy;
|
|
82
|
+
toRowLike: () => S;
|
|
83
|
+
compile: (opts?: {
|
|
84
|
+
isSubquery?: boolean;
|
|
85
|
+
}) => import('kysely').RawBuilder<unknown>;
|
|
86
|
+
}
|
|
87
|
+
declare class TableBase extends RpcToolset {
|
|
88
|
+
opts?: {
|
|
89
|
+
remapColumns?: boolean;
|
|
90
|
+
};
|
|
91
|
+
column: (this: InstanceType<TableClass<string>>, columnName: string) => ColumnReferenceExpression;
|
|
92
|
+
}
|
|
93
|
+
export type TableClass<N extends string = string> = {
|
|
94
|
+
new (opts?: {
|
|
95
|
+
remapColumns?: boolean;
|
|
96
|
+
}): TableBase;
|
|
97
|
+
as: <T extends TableClass, N2 extends string>(this: T, alias: N2) => Omit<T, keyof TableClass> & TableClass<N2> & {
|
|
98
|
+
new (): InstanceType<T>;
|
|
99
|
+
};
|
|
100
|
+
toRowLike: <T extends TableClass>(this: T, opts?: {
|
|
101
|
+
remapColumns?: boolean;
|
|
102
|
+
}) => InstanceType<T>;
|
|
103
|
+
from: <T extends TableClass>(this: T) => QueryBuilder<N, {
|
|
104
|
+
[k in N]: InstanceType<T>;
|
|
105
|
+
}, InstanceType<T>>;
|
|
106
|
+
on: <T extends TableClass>(this: T, on: NamespacedExpression<InstanceType<T>, SqlExpression>) => T;
|
|
107
|
+
compile: () => RawSql;
|
|
108
|
+
alias: N;
|
|
109
|
+
tableName: string;
|
|
110
|
+
onExpression?: SqlExpression;
|
|
111
|
+
};
|
|
112
|
+
export declare class Database {
|
|
113
|
+
private dialect;
|
|
114
|
+
private opts?;
|
|
115
|
+
private kysely?;
|
|
116
|
+
constructor(dialect: Dialect, opts?: {
|
|
117
|
+
logQuery?: (raw: CompiledQuery) => void;
|
|
118
|
+
returnExecutedQuery?: boolean;
|
|
119
|
+
} | undefined);
|
|
120
|
+
execute(query: RawSql): Promise<{
|
|
121
|
+
results: unknown[];
|
|
122
|
+
sql?: string;
|
|
123
|
+
parameters?: readonly unknown[];
|
|
124
|
+
}>;
|
|
125
|
+
Table<N extends string>(name: N): TableClass<N>;
|
|
126
|
+
}
|
|
127
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { RawSql } from './sql';
|
|
2
|
+
import { RpcToolset } from '../rpc-toolset';
|
|
3
|
+
type LiteralValue = number | string | boolean | null;
|
|
4
|
+
export type SqlExpressionIn = LiteralValue | SqlExpression;
|
|
5
|
+
export declare const asSqlExpression: (value: LiteralValue | SqlExpression) => SqlExpression;
|
|
6
|
+
export declare const isSqlExpressionIn: (value: unknown) => value is SqlExpressionIn;
|
|
7
|
+
export declare class SqlExpression extends RpcToolset {
|
|
8
|
+
precedence: number;
|
|
9
|
+
constructor(precedence?: number);
|
|
10
|
+
compile: () => RawSql;
|
|
11
|
+
or(expr: SqlExpression): BinaryExpression;
|
|
12
|
+
and(expr: SqlExpression): BinaryExpression;
|
|
13
|
+
not(): UnaryExpression;
|
|
14
|
+
isNull(): UnaryExpression;
|
|
15
|
+
isNotNull(): UnaryExpression;
|
|
16
|
+
'<'(expr: SqlExpression | number | string): BinaryExpression;
|
|
17
|
+
'<='(expr: SqlExpression | number | string): BinaryExpression;
|
|
18
|
+
'>'(expr: SqlExpression | number | string): BinaryExpression;
|
|
19
|
+
'>='(expr: SqlExpression | number | string): BinaryExpression;
|
|
20
|
+
'='(expr: SqlExpressionIn): BinaryExpression;
|
|
21
|
+
'<>'(expr: SqlExpressionIn): BinaryExpression;
|
|
22
|
+
'!='(expr: SqlExpressionIn): BinaryExpression;
|
|
23
|
+
'LIKE'(expr: SqlExpression | string): BinaryExpression;
|
|
24
|
+
'NOT LIKE'(expr: SqlExpression | string): BinaryExpression;
|
|
25
|
+
'+'(expr: SqlExpression | number | string): BinaryExpression;
|
|
26
|
+
'-'(expr: SqlExpression | number | string): BinaryExpression;
|
|
27
|
+
'*'(expr: SqlExpression | number | string): BinaryExpression;
|
|
28
|
+
'/'(expr: SqlExpression | number | string): BinaryExpression;
|
|
29
|
+
'%'(expr: SqlExpression | number | string): BinaryExpression;
|
|
30
|
+
asc(): OrderByValue;
|
|
31
|
+
desc(): OrderByValue;
|
|
32
|
+
}
|
|
33
|
+
export declare class BinaryExpression extends SqlExpression {
|
|
34
|
+
private readonly left;
|
|
35
|
+
private readonly right;
|
|
36
|
+
private readonly operator;
|
|
37
|
+
constructor(left: SqlExpression, right: SqlExpression, operator: RawSql, precedence?: number);
|
|
38
|
+
compile: () => import('kysely').RawBuilder<unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare class UnaryExpression extends SqlExpression {
|
|
41
|
+
private readonly operand;
|
|
42
|
+
private readonly operator;
|
|
43
|
+
private readonly placement;
|
|
44
|
+
constructor(operand: SqlExpression, operator: RawSql, placement: 'prefix' | 'postfix', precedence?: number);
|
|
45
|
+
compile: () => import('kysely').RawBuilder<unknown>;
|
|
46
|
+
}
|
|
47
|
+
export declare class ColumnReferenceExpression extends SqlExpression {
|
|
48
|
+
readonly alias: string;
|
|
49
|
+
readonly column: string;
|
|
50
|
+
constructor(alias: string, column: string);
|
|
51
|
+
compile: () => import('kysely').RawBuilder<unknown>;
|
|
52
|
+
}
|
|
53
|
+
export declare class UnboundColumnReferenceExpression extends ColumnReferenceExpression {
|
|
54
|
+
readonly alias: string;
|
|
55
|
+
readonly column: string;
|
|
56
|
+
constructor(alias: string, column: string);
|
|
57
|
+
compile: () => never;
|
|
58
|
+
}
|
|
59
|
+
export declare class LiteralExpression extends SqlExpression {
|
|
60
|
+
private readonly value;
|
|
61
|
+
constructor(value: LiteralValue);
|
|
62
|
+
compile: () => import('kysely').RawBuilder<unknown>;
|
|
63
|
+
}
|
|
64
|
+
export declare class OrderByValue {
|
|
65
|
+
value: SqlExpression;
|
|
66
|
+
direction?: RawSql | undefined;
|
|
67
|
+
constructor(value: SqlExpression, direction?: RawSql | undefined);
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dialect } from 'kysely';
|
|
2
|
+
import { RawSql } from './sql';
|
|
3
|
+
import { PGliteDialect } from 'kysely-pglite-dialect';
|
|
4
|
+
export declare const pgliteDialect: PGliteDialect;
|
|
5
|
+
export declare const dummyDialect: Dialect;
|
|
6
|
+
export declare const compiledQuery: (query: RawSql) => {
|
|
7
|
+
sql: string;
|
|
8
|
+
parameters: readonly unknown[];
|
|
9
|
+
};
|
package/dist/sql.d.ts
ADDED