@dxos/assistant 0.9.1-main.c7dcc2e112 → 0.10.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/dist/lib/neutral/extraction/index.mjs +1 -1
- package/dist/lib/neutral/extraction/index.mjs.map +1 -1
- package/dist/lib/neutral/index.mjs +387 -230
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts +1 -202
- package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/request/AiRequest.d.ts +13 -208
- package/dist/types/src/request/AiRequest.d.ts.map +1 -1
- package/dist/types/src/request/format.d.ts +1 -1
- package/dist/types/src/request/format.d.ts.map +1 -1
- package/dist/types/src/session/AiContext.d.ts +27 -105
- package/dist/types/src/session/AiContext.d.ts.map +1 -1
- package/dist/types/src/session/AiSession.d.ts +5 -29
- package/dist/types/src/session/AiSession.d.ts.map +1 -1
- package/dist/types/src/session/Harness.d.ts +122 -0
- package/dist/types/src/session/Harness.d.ts.map +1 -0
- package/dist/types/src/session/SessionLink.d.ts +8 -11
- package/dist/types/src/session/SessionLink.d.ts.map +1 -1
- package/dist/types/src/session/SessionLoader.d.ts +2 -2
- package/dist/types/src/session/SessionLoader.d.ts.map +1 -1
- package/dist/types/src/session/SkillHooks.d.ts +28 -0
- package/dist/types/src/session/SkillHooks.d.ts.map +1 -0
- package/dist/types/src/session/harness-control.d.ts +177 -0
- package/dist/types/src/session/harness-control.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +3 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +4 -4
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/templates/system.d.ts +4 -6
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/tool-runtime/index.d.ts.map +1 -0
- package/dist/types/src/tool-runtime/services.d.ts.map +1 -0
- package/dist/types/src/util/artifact.d.ts.map +1 -1
- package/dist/types/src/util/diff.d.ts +9 -3
- package/dist/types/src/util/diff.d.ts.map +1 -1
- package/dist/types/src/util/tracing.d.ts +40 -0
- package/dist/types/src/util/tracing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -25
- package/src/extraction/extraction-llm-function/proper-noun-extraction.ts +1 -1
- package/src/index.ts +1 -1
- package/src/request/AiRequest.ts +35 -14
- package/src/request/format.ts +9 -11
- package/src/session/AiContext.test.ts +52 -32
- package/src/session/AiContext.ts +73 -95
- package/src/session/AiSession.test.ts +4 -4
- package/src/session/AiSession.ts +43 -83
- package/src/session/Harness.ts +241 -0
- package/src/session/SessionLink.ts +8 -8
- package/src/session/SessionLoader.ts +4 -4
- package/src/session/SkillHooks.ts +71 -0
- package/src/session/harness-control.ts +30 -0
- package/src/session/index.ts +3 -0
- package/src/session/toolkit.ts +8 -8
- package/src/templates/instructions/format.tpl +3 -3
- package/src/templates/instructions/system.tpl +10 -12
- package/src/templates/system.ts +6 -2
- package/src/util/artifact.ts +9 -2
- package/src/util/diff.test.ts +4 -4
- package/src/util/diff.ts +15 -8
- package/src/util/tracing.ts +1 -1
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/services.d.ts.map +0 -1
- /package/dist/types/src/{functions → tool-runtime}/index.d.ts +0 -0
- /package/dist/types/src/{functions → tool-runtime}/services.d.ts +0 -0
- /package/src/{functions → tool-runtime}/index.ts +0 -0
- /package/src/{functions → tool-runtime}/services.ts +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import * as DateTime from 'effect/DateTime';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import type * as Runtime from 'effect/Runtime';
|
|
5
|
+
import type * as Scope from 'effect/Scope';
|
|
6
|
+
import { LayerSpec } from '@dxos/compute';
|
|
7
|
+
import { ProcessManager } from '@dxos/compute-runtime';
|
|
8
|
+
import { Database, Feed, Filter, Obj, type URI } from '@dxos/echo';
|
|
9
|
+
import { BaseError } from '@dxos/errors';
|
|
10
|
+
import { type ContentBlock, Message } from '@dxos/types';
|
|
11
|
+
import * as AiContext from './AiContext';
|
|
12
|
+
export interface Service {
|
|
13
|
+
/** The conversation {@link AiContext.Binder} (Tier A). */
|
|
14
|
+
binder: Effect.Effect<AiContext.Binder, NotSupportedError>;
|
|
15
|
+
/** The conversation message history (Tier A). */
|
|
16
|
+
history: Effect.Effect<Message.Message[], NotSupportedError>;
|
|
17
|
+
/** Objects bound to the conversation that match the filter (Tier A). */
|
|
18
|
+
queryContext<T extends Obj.Unknown>(filter: Filter.Filter<T>): Effect.Effect<T[], NotSupportedError>;
|
|
19
|
+
/** Enqueue a message into the owning host's input queue (Tier B). */
|
|
20
|
+
enqueueMessage(options: EnqueueMessageOptions): Effect.Effect<void, NotSupportedError>;
|
|
21
|
+
/** Schedule a self-wake on the owning host (Tier B). */
|
|
22
|
+
setAlarm(options: SetAlarmOptions): Effect.Effect<void, NotSupportedError>;
|
|
23
|
+
}
|
|
24
|
+
declare const HarnessService_base: Context.TagClass<HarnessService, "@dxos/assistant/HarnessService", Service>;
|
|
25
|
+
/**
|
|
26
|
+
* Provides access to the controlling harness for tools and operations that are executed by the agent.
|
|
27
|
+
*
|
|
28
|
+
* Replaces AiContextService and AiSessionService.
|
|
29
|
+
*/
|
|
30
|
+
export declare class HarnessService extends HarnessService_base {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Acess current context binder.
|
|
34
|
+
*/
|
|
35
|
+
export declare const binder: Effect.Effect<AiContext.Binder, NotSupportedError, HarnessService>;
|
|
36
|
+
/**
|
|
37
|
+
* Query the context using a filter.
|
|
38
|
+
*/
|
|
39
|
+
export declare const queryContext: <T extends Obj.Unknown>(filter: Filter.Filter<T>) => Effect.Effect<T[], NotSupportedError, HarnessService>;
|
|
40
|
+
interface EnqueueMessageOptions {
|
|
41
|
+
content: ContentBlock.Any[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Query the session history.
|
|
45
|
+
*/
|
|
46
|
+
export declare const history: Effect.Effect<Message.Message[], NotSupportedError, HarnessService>;
|
|
47
|
+
/**
|
|
48
|
+
* Enqueue a message to the harness.
|
|
49
|
+
*/
|
|
50
|
+
export declare const enqueueMessage: (options: EnqueueMessageOptions) => Effect.Effect<void, NotSupportedError, HarnessService>;
|
|
51
|
+
interface SetAlarmOptions {
|
|
52
|
+
at: DateTime.DateTime;
|
|
53
|
+
/**
|
|
54
|
+
* Message to send when the alarm fires.
|
|
55
|
+
*/
|
|
56
|
+
message: string | null;
|
|
57
|
+
}
|
|
58
|
+
export declare const setAlarm: (options: SetAlarmOptions) => Effect.Effect<void, NotSupportedError, HarnessService>;
|
|
59
|
+
/**
|
|
60
|
+
* Binds skills and/or objects to the conversation context.
|
|
61
|
+
*/
|
|
62
|
+
export declare const bindContext: ({ skills, objects, }: AiContext.BindingProps) => Effect.Effect<void, NotSupportedError, HarnessService>;
|
|
63
|
+
declare const NotSupportedError_base: {
|
|
64
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
65
|
+
cause?: unknown;
|
|
66
|
+
stack?: string;
|
|
67
|
+
name: "NotSupportedError";
|
|
68
|
+
context: Record<string, unknown>;
|
|
69
|
+
readonly message: string;
|
|
70
|
+
readonly _tag: "NotSupportedError";
|
|
71
|
+
};
|
|
72
|
+
isError(error: unknown): error is Error;
|
|
73
|
+
name: "NotSupportedError";
|
|
74
|
+
is(error: unknown): error is BaseError;
|
|
75
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
|
|
76
|
+
ifTypeDiffers?: boolean;
|
|
77
|
+
}): (error: unknown) => {
|
|
78
|
+
cause?: unknown;
|
|
79
|
+
stack?: string;
|
|
80
|
+
name: "NotSupportedError";
|
|
81
|
+
context: Record<string, unknown>;
|
|
82
|
+
readonly message: string;
|
|
83
|
+
readonly _tag: "NotSupportedError";
|
|
84
|
+
};
|
|
85
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
86
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
87
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
88
|
+
stackTraceLimit: number;
|
|
89
|
+
};
|
|
90
|
+
export declare class NotSupportedError extends NotSupportedError_base {
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Process-affinity {@link LayerSpec} that materialises {@link HarnessService} from the resolution
|
|
94
|
+
* context's `conversation` DXN. Merges the former `AiContext.Service` (Tier A) with live host
|
|
95
|
+
* dispatch (Tier B).
|
|
96
|
+
*/
|
|
97
|
+
export declare const layerSpec: LayerSpec.LayerSpec;
|
|
98
|
+
interface MakeOptions {
|
|
99
|
+
conversation: URI.URI;
|
|
100
|
+
processManager: Context.Tag.Service<ProcessManager.Service>;
|
|
101
|
+
runtime: Runtime.Runtime<Database.Service>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Builds the {@link Service} for a conversation-scoped resolution context. Tier A resolves the
|
|
105
|
+
* conversation feed / {@link AiContext.Binder} once; Tier B looks up the owning host process lazily per call
|
|
106
|
+
* and dispatches over its `Handle.rpc` control surface (raising {@link NotSupportedError} when no
|
|
107
|
+
* live host owns the conversation).
|
|
108
|
+
*/
|
|
109
|
+
export declare const make: ({ conversation, processManager, runtime, }: MakeOptions) => Effect.Effect<Service, never, Scope.Scope>;
|
|
110
|
+
interface FromBinderOptions {
|
|
111
|
+
feed: Feed.Feed;
|
|
112
|
+
runtime: Runtime.Runtime<Database.Service>;
|
|
113
|
+
binder: AiContext.Binder;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Builds the {@link Service} from a {@link AiContext.Binder} already opened for the conversation (e.g. the
|
|
117
|
+
* agent's own turn fiber, which has no `ProcessManager.Service` in scope). Tier A is fully served;
|
|
118
|
+
* Tier B raises {@link NotSupportedError} since the live-host control surface is not reachable here.
|
|
119
|
+
*/
|
|
120
|
+
export declare const fromBinder: ({ feed, runtime, binder }: FromBinderOptions) => Service;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=Harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Harness.d.ts","sourceRoot":"","sources":["../../../../src/session/Harness.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Feed, Obj, Type } from '@dxos/echo';
|
|
2
|
+
declare const SessionLink_base: Type.ObjClass<SessionLink, {
|
|
3
|
+
readonly feedRef: import("@dxos/echo/internal").Ref<Feed.Feed & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
4
|
+
readonly messageId: string;
|
|
5
|
+
}, {}>;
|
|
3
6
|
/**
|
|
4
7
|
* Feed-level record that links this session to a point in another session's history.
|
|
5
8
|
* When present in a feed, the messages from the referenced feed up to and including
|
|
6
9
|
* `messageId` are prepended to the conversation history before each turn.
|
|
7
10
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly kind?: string | undefined;
|
|
12
|
-
readonly namespace?: "data" | "trace" | undefined;
|
|
13
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
14
|
-
readonly messageId: string;
|
|
15
|
-
}, Schema.Struct.Fields>;
|
|
16
|
-
export type SessionLink = Type.InstanceType<typeof SessionLink>;
|
|
11
|
+
export declare class SessionLink extends SessionLink_base {
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
17
14
|
//# sourceMappingURL=SessionLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionLink.d.ts","sourceRoot":"","sources":["../../../../src/session/SessionLink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SessionLink.d.ts","sourceRoot":"","sources":["../../../../src/session/SessionLink.ts"],"names":[],"mappings":"AAQA,OAAO,EAAO,IAAI,EAAE,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;;;;;AAEvD;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,gBAOhC;CAAG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Feed } from '@dxos/echo';
|
|
2
|
+
import { Database, Feed } from '@dxos/echo';
|
|
3
3
|
import { Message } from '@dxos/types';
|
|
4
4
|
/**
|
|
5
5
|
* Loads and reifies conversation history by resolving SessionLink feed records.
|
|
@@ -10,6 +10,6 @@ export declare class SessionLoader {
|
|
|
10
10
|
* Queries the feed for any SessionLink record; if found, loads messages from
|
|
11
11
|
* the referenced feed up to and including `messageId` and prepends them.
|
|
12
12
|
*/
|
|
13
|
-
reifyHistory(feed: Feed.Feed, messages: Message.Message[]): Effect.Effect<Message.Message[], never,
|
|
13
|
+
reifyHistory(feed: Feed.Feed, messages: Message.Message[]): Effect.Effect<Message.Message[], never, Database.Service>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=SessionLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionLoader.d.ts","sourceRoot":"","sources":["../../../../src/session/SessionLoader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionLoader.d.ts","sourceRoot":"","sources":["../../../../src/session/SessionLoader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC;;GAEG;AACH,qBAAa,aAAa;IACxB;;;;OAIG;IACH,YAAY,CACV,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,GAC1B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CA8B3D;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Operation, Skill } from '@dxos/compute';
|
|
3
|
+
import { Database } from '@dxos/echo';
|
|
4
|
+
/**
|
|
5
|
+
* Tag of the lifecycle point a hook fires at, matching {@link Skill.HookSpec}.
|
|
6
|
+
*/
|
|
7
|
+
export type HookPhase = 'begin-request' | 'end-request';
|
|
8
|
+
/**
|
|
9
|
+
* Invokes a resolved operation with the hook's templated input. Begin and end hooks fire in
|
|
10
|
+
* different contexts (the agent's turn fiber vs. a child process with Tier B reachable), so the
|
|
11
|
+
* invocation strategy is supplied by the caller rather than fixed here. `R` carries the invoker's
|
|
12
|
+
* own requirements (e.g. `Operation.Service`) up into {@link runHooks}.
|
|
13
|
+
*/
|
|
14
|
+
export type HookInvoker<R> = (operation: Operation.Definition.Any, input: Record<string, unknown>) => Effect.Effect<void, never, R>;
|
|
15
|
+
/**
|
|
16
|
+
* Runs every {@link Skill.Hook} on `skills` whose spec matches `phase`. Each hook resolves its
|
|
17
|
+
* `function` ref to a {@link Operation.PersistentOperation}, deserializes it to a definition, and
|
|
18
|
+
* invokes it with the templated `input` via `invoke`. Hooks without a function ref are skipped.
|
|
19
|
+
*
|
|
20
|
+
* Hook failures are isolated: a throwing hook logs and is swallowed so one skill's hook cannot
|
|
21
|
+
* abort the request lifecycle (or the sibling hooks).
|
|
22
|
+
*/
|
|
23
|
+
export declare const runHooks: <R>({ skills, phase, invoke, }: {
|
|
24
|
+
skills: readonly Skill.Skill[];
|
|
25
|
+
phase: HookPhase;
|
|
26
|
+
invoke: HookInvoker<R>;
|
|
27
|
+
}) => Effect.Effect<void, never, Database.Service | R>;
|
|
28
|
+
//# sourceMappingURL=SkillHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillHooks.d.ts","sourceRoot":"","sources":["../../../../src/session/SkillHooks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAO,MAAM,YAAY,CAAC;AAI3C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,aAAa,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAC3B,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,EACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,8BAIvB;IACD,MAAM,EAAE,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACxB,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,CAAC,CAyB/C,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import * as Rpc from '@effect/rpc/Rpc';
|
|
2
|
+
import * as RpcGroup from '@effect/rpc/RpcGroup';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
/**
|
|
5
|
+
* Typed control surface on the live host process that owns a conversation's harness.
|
|
6
|
+
*
|
|
7
|
+
* The same group is declared as the agent process's `rpcs` (so its handlers run on the host's
|
|
8
|
+
* server fiber with the live `AlarmManager`/`inputQueue` in scope) and used by {@link HarnessService}
|
|
9
|
+
* Tier B to dispatch over the discovered host's `Handle.rpc` — keeping both ends on one contract.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HarnessControl: RpcGroup.RpcGroup<Rpc.Rpc<"enqueueMessage", Schema.Struct<{
|
|
12
|
+
content: Schema.Array$<Schema.Union<[Schema.TaggedStruct<"anchor", {
|
|
13
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
14
|
+
objectId: import("@dxos/keys").EntityIdClass;
|
|
15
|
+
version: typeof Schema.Unknown;
|
|
16
|
+
}>, Schema.TaggedStruct<"file", {
|
|
17
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
18
|
+
url: typeof Schema.String;
|
|
19
|
+
name: Schema.optional<typeof Schema.String>;
|
|
20
|
+
mediaType: Schema.optional<typeof Schema.String>;
|
|
21
|
+
}>, Schema.TaggedStruct<"image", {
|
|
22
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
23
|
+
id: Schema.optional<typeof Schema.String>;
|
|
24
|
+
source: Schema.optional<Schema.Union<[Schema.Struct<{
|
|
25
|
+
type: Schema.Literal<["base64"]>;
|
|
26
|
+
mediaType: typeof Schema.String;
|
|
27
|
+
data: typeof Schema.String;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
type: Schema.Literal<["http"]>;
|
|
30
|
+
url: typeof Schema.String;
|
|
31
|
+
}>]>>;
|
|
32
|
+
}>, Schema.TaggedStruct<"json", {
|
|
33
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
34
|
+
disposition: Schema.optional<Schema.Literal<["user", "synthetic", "cot", "version-pin"]>>;
|
|
35
|
+
data: typeof Schema.String;
|
|
36
|
+
}>, Schema.TaggedStruct<"proposal", {
|
|
37
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
38
|
+
text: typeof Schema.String;
|
|
39
|
+
}>, Schema.TaggedStruct<"reasoning", {
|
|
40
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
41
|
+
reasoningText: Schema.optional<typeof Schema.String>;
|
|
42
|
+
redactedText: Schema.optional<typeof Schema.String>;
|
|
43
|
+
signature: Schema.optional<typeof Schema.String>;
|
|
44
|
+
}>, Schema.TaggedStruct<"reference", {
|
|
45
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
46
|
+
reference: import("@dxos/echo/Ref").RefSchema<import("@dxos/echo/Obj").Unknown>;
|
|
47
|
+
}>, Schema.TaggedStruct<"select", {
|
|
48
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
49
|
+
options: Schema.mutable<Schema.Array$<typeof Schema.String>>;
|
|
50
|
+
}>, Schema.TaggedStruct<"status", {
|
|
51
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
52
|
+
statusText: typeof Schema.String;
|
|
53
|
+
}>, Schema.TaggedStruct<"suggestion", {
|
|
54
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
55
|
+
text: typeof Schema.String;
|
|
56
|
+
}>, Schema.TaggedStruct<"stats", {
|
|
57
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
58
|
+
mimeType: Schema.optional<typeof Schema.String>;
|
|
59
|
+
message: Schema.optional<typeof Schema.String>;
|
|
60
|
+
model: Schema.optional<typeof Schema.String>;
|
|
61
|
+
usage: Schema.optional<Schema.Struct<{
|
|
62
|
+
inputTokens: Schema.optional<typeof Schema.Number>;
|
|
63
|
+
outputTokens: Schema.optional<typeof Schema.Number>;
|
|
64
|
+
totalTokens: Schema.optional<typeof Schema.Number>;
|
|
65
|
+
}>>;
|
|
66
|
+
toolCalls: Schema.optional<typeof Schema.Number>;
|
|
67
|
+
errors: Schema.optional<typeof Schema.Number>;
|
|
68
|
+
duration: Schema.optional<typeof Schema.Number>;
|
|
69
|
+
finishReason: Schema.optional<Schema.Literal<["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>>;
|
|
70
|
+
}>, Schema.TaggedStruct<"surface", {
|
|
71
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
72
|
+
role: typeof Schema.String;
|
|
73
|
+
data: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
74
|
+
}>, Schema.TaggedStruct<"text", {
|
|
75
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
76
|
+
mimeType: Schema.optional<typeof Schema.String>;
|
|
77
|
+
text: typeof Schema.String;
|
|
78
|
+
disposition: Schema.optional<Schema.Literal<["user", "synthetic", "cot", "version-pin"]>>;
|
|
79
|
+
}>, Schema.TaggedStruct<"summary", {
|
|
80
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
81
|
+
content: typeof Schema.String;
|
|
82
|
+
}>, Schema.TaggedStruct<"toolkit", {
|
|
83
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
84
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
85
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
86
|
+
toolCallId: typeof Schema.String;
|
|
87
|
+
name: typeof Schema.String;
|
|
88
|
+
input: typeof Schema.String;
|
|
89
|
+
providerExecuted: typeof Schema.Boolean;
|
|
90
|
+
operationKey: Schema.optional<typeof Schema.String>;
|
|
91
|
+
operationName: Schema.optional<typeof Schema.String>;
|
|
92
|
+
operationIcon: Schema.optional<typeof Schema.String>;
|
|
93
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
94
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
95
|
+
toolCallId: typeof Schema.String;
|
|
96
|
+
name: typeof Schema.String;
|
|
97
|
+
result: Schema.optional<Schema.Union<[typeof Schema.String, Schema.suspend<{
|
|
98
|
+
readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
|
|
99
|
+
readonly content: readonly ({
|
|
100
|
+
readonly _tag: "text";
|
|
101
|
+
readonly pending?: boolean | undefined;
|
|
102
|
+
readonly mimeType?: string | undefined;
|
|
103
|
+
readonly text: string;
|
|
104
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
readonly _tag: "image";
|
|
107
|
+
readonly pending?: boolean | undefined;
|
|
108
|
+
readonly id?: string | undefined;
|
|
109
|
+
readonly source?: {
|
|
110
|
+
readonly type: "base64";
|
|
111
|
+
readonly mediaType: string;
|
|
112
|
+
readonly data: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly type: "http";
|
|
115
|
+
readonly url: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
} | {
|
|
118
|
+
readonly _tag: "file";
|
|
119
|
+
readonly pending?: boolean | undefined;
|
|
120
|
+
readonly url: string;
|
|
121
|
+
readonly name?: string | undefined;
|
|
122
|
+
readonly mediaType?: string | undefined;
|
|
123
|
+
})[];
|
|
124
|
+
}, {
|
|
125
|
+
readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
|
|
126
|
+
readonly content: readonly ({
|
|
127
|
+
readonly _tag: "text";
|
|
128
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
129
|
+
readonly mimeType?: string | undefined;
|
|
130
|
+
readonly pending?: boolean | undefined;
|
|
131
|
+
readonly text: string;
|
|
132
|
+
} | {
|
|
133
|
+
readonly _tag: "image";
|
|
134
|
+
readonly id?: string | undefined;
|
|
135
|
+
readonly pending?: boolean | undefined;
|
|
136
|
+
readonly source?: {
|
|
137
|
+
readonly data: string;
|
|
138
|
+
readonly mediaType: string;
|
|
139
|
+
readonly type: "base64";
|
|
140
|
+
} | {
|
|
141
|
+
readonly type: "http";
|
|
142
|
+
readonly url: string;
|
|
143
|
+
} | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
readonly _tag: "file";
|
|
146
|
+
readonly mediaType?: string | undefined;
|
|
147
|
+
readonly name?: string | undefined;
|
|
148
|
+
readonly pending?: boolean | undefined;
|
|
149
|
+
readonly url: string;
|
|
150
|
+
})[];
|
|
151
|
+
}, never>]>>;
|
|
152
|
+
error: Schema.optional<typeof Schema.String>;
|
|
153
|
+
providerExecuted: typeof Schema.Boolean;
|
|
154
|
+
}>, Schema.TaggedStruct<"transcript", {
|
|
155
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
156
|
+
started: typeof Schema.String;
|
|
157
|
+
text: typeof Schema.String;
|
|
158
|
+
corrected: Schema.optional<typeof Schema.String>;
|
|
159
|
+
references: Schema.optional<Schema.mutable<Schema.Array$<import("@dxos/echo/Ref").RefSchema<import("@dxos/echo/Obj").Unknown>>>>;
|
|
160
|
+
candidates: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
|
|
161
|
+
text: typeof Schema.String;
|
|
162
|
+
kind: Schema.Literal<["noun", "proper-noun"]>;
|
|
163
|
+
start: typeof Schema.Number;
|
|
164
|
+
end: typeof Schema.Number;
|
|
165
|
+
suggested: Schema.optional<Schema.Struct<{
|
|
166
|
+
typename: typeof Schema.String;
|
|
167
|
+
}>>;
|
|
168
|
+
}>>>>;
|
|
169
|
+
translation: Schema.optional<typeof Schema.String>;
|
|
170
|
+
}>]>>;
|
|
171
|
+
}>, typeof Schema.Void, typeof Schema.Never, never> | Rpc.Rpc<"setAlarm", Schema.Struct<{
|
|
172
|
+
at: typeof Schema.DateTimeUtc;
|
|
173
|
+
message: Schema.NullOr<typeof Schema.String>;
|
|
174
|
+
}>, typeof Schema.Void, typeof Schema.Never, never>>;
|
|
175
|
+
/** Union of the RPCs declared in {@link HarnessControl}. */
|
|
176
|
+
export type HarnessControlRpcs = RpcGroup.Rpcs<typeof HarnessControl>;
|
|
177
|
+
//# sourceMappingURL=harness-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-control.d.ts","sourceRoot":"","sources":["../../../../src/session/harness-control.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAS1B,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './toolkit';
|
|
2
2
|
export * as AiContext from './AiContext';
|
|
3
3
|
export * as AiSession from './AiSession';
|
|
4
|
+
export * as Harness from './Harness';
|
|
5
|
+
export * as SkillHooks from './SkillHooks';
|
|
6
|
+
export { HarnessControl, type HarnessControlRpcs } from './harness-control';
|
|
4
7
|
export { SessionLoader } from './SessionLoader';
|
|
5
8
|
export * as SessionLink from './SessionLink';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as Effect from 'effect/Effect';
|
|
2
2
|
import { type AiToolNotFoundError, OpaqueToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
3
|
-
import { type
|
|
3
|
+
import { type Skill } from '@dxos/compute';
|
|
4
4
|
export type CreateToolkitProps = {
|
|
5
5
|
toolkit?: OpaqueToolkit.Any;
|
|
6
|
-
|
|
6
|
+
skills?: readonly Skill.Skill[];
|
|
7
7
|
/**
|
|
8
8
|
* Self-contained with handlers toolkits.
|
|
9
9
|
*/
|
|
10
10
|
opaqueToolkits?: readonly OpaqueToolkit.Any[];
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* Build a combined toolkit from the
|
|
13
|
+
* Build a combined toolkit from the skill tools and the provided toolkit.
|
|
14
14
|
*/
|
|
15
|
-
export declare const createToolkit: ({ toolkit: toolkitProp,
|
|
15
|
+
export declare const createToolkit: ({ toolkit: toolkitProp, skills, opaqueToolkits, }: CreateToolkitProps) => Effect.Effect<OpaqueToolkit.OpaqueToolkit, AiToolNotFoundError, ToolResolverService | ToolExecutionService>;
|
|
16
16
|
//# sourceMappingURL=toolkit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,aAAa,CAAC,GAAG,EAAE,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,sDAIvB,kBAAkB,KAAG,MAAM,CAAC,MAAM,CACnC,aAAa,CAAC,aAAa,EAC3B,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,CAeuE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Model } from '@dxos/ai';
|
|
2
|
+
import { type Text } from '@dxos/schema';
|
|
2
3
|
/**
|
|
3
4
|
* System template variables.
|
|
4
5
|
*/
|
|
5
|
-
export type SystemPromptOptions =
|
|
6
|
+
export type SystemPromptOptions = Model.Capabilities & {
|
|
6
7
|
DATETIME: string;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
@@ -12,10 +13,7 @@ export type SystemPromptOptions = ModelCapabilities & {
|
|
|
12
13
|
export declare const createSystemPrompt: (options?: Partial<SystemPromptOptions>) => string;
|
|
13
14
|
export declare const templates: {
|
|
14
15
|
system: {
|
|
15
|
-
readonly source: import("@dxos/echo/internal").Ref<
|
|
16
|
-
readonly name?: string | undefined;
|
|
17
|
-
readonly content: string;
|
|
18
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & import("@dxos/echo/Obj").Unknown>;
|
|
16
|
+
readonly source: import("@dxos/echo/internal").Ref<Text.Text & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & import("@dxos/echo/Obj").Unknown>;
|
|
19
17
|
readonly inputs?: readonly {
|
|
20
18
|
readonly name: string;
|
|
21
19
|
readonly kind: "operation" | "value";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAKzC;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,YAAY,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAa,OAAO,CAAC,mBAAmB,CAAC,WAMrE,CAAC;AAOJ,eAAO,MAAM,SAAS;IACpB,MAAM;;;;;;;;;CAIP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tool-runtime/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/tool-runtime/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAGxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAAuB,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKxD,eAAO,MAAM,8BAA8B,GAAI,CAAC,GAAG,KAAK,+BAErD;IAAE,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;CAAE,KAAQ,KAAK,CAAC,KAAK,CAC9E,mBAAmB,EACnB,KAAK,EACL,aAAa,CAAC,qBAAqB,GAAG,QAAQ,CAAC,OAAO,GAAG,CAAC,CA8B3D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,CAAC,QAAQ;IACnD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpE,KAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAkC7E,CAAC;AAEJ,eAAO,MAAM,4CAA4C,QAAO,KAAK,CAAC,KAAK,CACzE,oBAAoB,EACpB,KAAK,EACL,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,qBAAqB,CAgBxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,4IAGjC,CAAC;AAOF,eAAO,MAAM,oBAAoB,SAAU,IAAI,CAAC,GAAG,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAE3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../../src/util/artifact.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGpD;;GAEG;AACH,eAAO,MAAM,qBAAqB,OAAQ,QAAQ,WAA4B,CAAC;AAqE/E,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,UAAU;eAjEV,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG;aAC9D,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,EAChC,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,WAAW,KACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../../src/util/artifact.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGpD;;GAEG;AACH,eAAO,MAAM,qBAAqB,OAAQ,QAAQ,WAA4B,CAAC;AAqE/E,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,UAAU;eAjEV,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG;aAC9D,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,EAChC,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,WAAW,KACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC;8BA0EnF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Doc } from '@dxos/echo-doc';
|
|
2
2
|
export type Diff = {
|
|
3
3
|
match: string;
|
|
4
4
|
replace: string;
|
|
@@ -7,11 +7,17 @@ export type Diff = {
|
|
|
7
7
|
* Convert a list of diffs into a list of operations.
|
|
8
8
|
*/
|
|
9
9
|
export declare const reduceDiffs: (diffs: readonly string[]) => Diff[];
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Resolves text diffs against the accessor's current value into cursor-anchored replacements.
|
|
12
|
+
*/
|
|
13
|
+
export declare const computeDiffsWithCursors: <T>(accessor: Doc.Accessor<T>, diffs: readonly string[]) => {
|
|
11
14
|
cursor: string;
|
|
12
15
|
text: string;
|
|
13
16
|
}[];
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Applies text diffs to the accessor-backed document and returns the resulting string.
|
|
19
|
+
*/
|
|
20
|
+
export declare const applyDiffs: <T>(accessor: Doc.Accessor<T>, diffs: readonly string[], { errorOnNotFound }?: {
|
|
15
21
|
errorOnNotFound?: boolean;
|
|
16
22
|
}) => string;
|
|
17
23
|
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../src/util/diff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../src/util/diff.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAcrC,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,UAAW,SAAS,MAAM,EAAE,KAAG,IAAI,EA0B1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE;;;GAU7F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,YAChB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,SAClB,SAAS,MAAM,EAAE,wBACK;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,KACzD,MAoBF,CAAC"}
|
|
@@ -66,6 +66,7 @@ export declare const PartialBlock: Trace.EventType<{
|
|
|
66
66
|
readonly toolCalls?: number | undefined;
|
|
67
67
|
readonly errors?: number | undefined;
|
|
68
68
|
readonly duration?: number | undefined;
|
|
69
|
+
readonly finishReason?: "content-filter" | "error" | "length" | "other" | "pause" | "stop" | "tool-calls" | "unknown" | undefined;
|
|
69
70
|
} | {
|
|
70
71
|
readonly _tag: "status";
|
|
71
72
|
readonly pending?: boolean | undefined;
|
|
@@ -78,6 +79,13 @@ export declare const PartialBlock: Trace.EventType<{
|
|
|
78
79
|
readonly _tag: "summary";
|
|
79
80
|
readonly pending?: boolean | undefined;
|
|
80
81
|
readonly content: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly _tag: "surface";
|
|
84
|
+
readonly pending?: boolean | undefined;
|
|
85
|
+
readonly role: string;
|
|
86
|
+
readonly data?: {
|
|
87
|
+
readonly [x: string]: unknown;
|
|
88
|
+
} | undefined;
|
|
81
89
|
} | {
|
|
82
90
|
readonly _tag: "text";
|
|
83
91
|
readonly pending?: boolean | undefined;
|
|
@@ -137,6 +145,18 @@ export declare const PartialBlock: Trace.EventType<{
|
|
|
137
145
|
readonly pending?: boolean | undefined;
|
|
138
146
|
readonly started: string;
|
|
139
147
|
readonly text: string;
|
|
148
|
+
readonly corrected?: string | undefined;
|
|
149
|
+
readonly references?: import("@dxos/echo/internal").Ref<Obj.Unknown>[] | undefined;
|
|
150
|
+
readonly candidates?: {
|
|
151
|
+
readonly text: string;
|
|
152
|
+
readonly kind: "noun" | "proper-noun";
|
|
153
|
+
readonly start: number;
|
|
154
|
+
readonly end: number;
|
|
155
|
+
readonly suggested?: {
|
|
156
|
+
readonly typename: string;
|
|
157
|
+
} | undefined;
|
|
158
|
+
}[] | undefined;
|
|
159
|
+
readonly translation?: string | undefined;
|
|
140
160
|
};
|
|
141
161
|
}>;
|
|
142
162
|
/**
|
|
@@ -205,6 +225,7 @@ export declare const CompleteBlock: Trace.EventType<{
|
|
|
205
225
|
readonly toolCalls?: number | undefined;
|
|
206
226
|
readonly errors?: number | undefined;
|
|
207
227
|
readonly duration?: number | undefined;
|
|
228
|
+
readonly finishReason?: "content-filter" | "error" | "length" | "other" | "pause" | "stop" | "tool-calls" | "unknown" | undefined;
|
|
208
229
|
} | {
|
|
209
230
|
readonly _tag: "status";
|
|
210
231
|
readonly pending?: boolean | undefined;
|
|
@@ -217,6 +238,13 @@ export declare const CompleteBlock: Trace.EventType<{
|
|
|
217
238
|
readonly _tag: "summary";
|
|
218
239
|
readonly pending?: boolean | undefined;
|
|
219
240
|
readonly content: string;
|
|
241
|
+
} | {
|
|
242
|
+
readonly _tag: "surface";
|
|
243
|
+
readonly pending?: boolean | undefined;
|
|
244
|
+
readonly role: string;
|
|
245
|
+
readonly data?: {
|
|
246
|
+
readonly [x: string]: unknown;
|
|
247
|
+
} | undefined;
|
|
220
248
|
} | {
|
|
221
249
|
readonly _tag: "text";
|
|
222
250
|
readonly pending?: boolean | undefined;
|
|
@@ -276,6 +304,18 @@ export declare const CompleteBlock: Trace.EventType<{
|
|
|
276
304
|
readonly pending?: boolean | undefined;
|
|
277
305
|
readonly started: string;
|
|
278
306
|
readonly text: string;
|
|
307
|
+
readonly corrected?: string | undefined;
|
|
308
|
+
readonly references?: import("@dxos/echo/internal").Ref<Obj.Unknown>[] | undefined;
|
|
309
|
+
readonly candidates?: {
|
|
310
|
+
readonly text: string;
|
|
311
|
+
readonly kind: "noun" | "proper-noun";
|
|
312
|
+
readonly start: number;
|
|
313
|
+
readonly end: number;
|
|
314
|
+
readonly suggested?: {
|
|
315
|
+
readonly typename: string;
|
|
316
|
+
} | undefined;
|
|
317
|
+
}[] | undefined;
|
|
318
|
+
readonly translation?: string | undefined;
|
|
279
319
|
};
|
|
280
320
|
}>;
|
|
281
321
|
export declare const AgentRequestBegin: Trace.EventType<{}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/util/tracing.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC;;GAEG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/util/tracing.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAC;AAEH,eAAO,MAAM,iBAAiB,qBAG5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;EAM1B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;EAOzB,CAAC"}
|