@xandreed/core 0.3.0 → 0.8.0-next.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/README.md +1 -1
- package/dist/conformance.entity.d.ts +15 -0
- package/dist/conformance.entity.js +7 -0
- package/dist/decision-record.entity.d.ts +31 -0
- package/dist/decision-record.entity.functions.d.ts +6 -0
- package/dist/decision-record.entity.functions.js +3 -0
- package/dist/decision-record.entity.js +24 -0
- package/dist/domain/agent-failure.entity.d.ts +6 -6
- package/dist/domain/agent-failure.entity.js +12 -1
- package/dist/domain/failure.entity.d.ts +2 -2
- package/dist/domain/loop-event.entity.d.ts +2 -0
- package/dist/domain/message.entity.d.ts +143 -156
- package/dist/domain/message.entity.js +6 -6
- package/dist/domain/model-call-policy.entity.d.ts +3 -3
- package/dist/domain/model-call-policy.entity.js +1 -1
- package/dist/domain/model-catalog.entity.d.ts +4 -4
- package/dist/domain/model-catalog.entity.js +1 -1
- package/dist/domain/model-selection.entity.d.ts +6 -13
- package/dist/domain/prompt-provenance.entity.d.ts +6 -6
- package/dist/domain/prompt-provenance.entity.js +4 -4
- package/dist/domain/token-usage.entity.d.ts +4 -4
- package/dist/harness/capability.entity.d.ts +88 -41
- package/dist/harness/capability.entity.functions.d.ts +30 -1
- package/dist/harness/capability.entity.functions.js +55 -2
- package/dist/harness/capability.entity.js +33 -12
- package/dist/harness/config.entity.d.ts +28 -28
- package/dist/harness/config.entity.js +4 -4
- package/dist/harness/plugin-stack.adapter.d.ts +24 -0
- package/dist/harness/plugin-stack.adapter.js +8 -0
- package/dist/harness/plugin-stack.adapter.test.d.ts +1 -0
- package/dist/harness/plugin.adapter.d.ts +15 -4
- package/dist/harness/plugin.adapter.js +18 -11
- package/dist/harness/plugin.adapter.test.d.ts +1 -0
- package/dist/harness/plugin.entity.d.ts +26 -10
- package/dist/harness/plugin.entity.js +1 -1
- package/dist/harness/session.entity.d.ts +20 -20
- package/dist/harness/session.entity.js +1 -1
- package/dist/harness/skill-files.d.ts +17 -0
- package/dist/harness/skill-files.js +25 -0
- package/dist/index.d.ts +48 -4
- package/dist/index.js +46 -4
- package/dist/loop/cacheKey.d.ts +3 -3
- package/dist/loop/cacheKey.js +4 -2
- package/dist/loop/mapping.d.ts +4 -5
- package/dist/loop/mapping.js +8 -16
- package/dist/loop/modelPolicy.d.ts +4 -4
- package/dist/loop/modelPolicy.js +2 -2
- package/dist/loop/promptProvenance.d.ts +2 -2
- package/dist/loop/promptProvenance.js +2 -2
- package/dist/loop/stepContext.d.ts +2 -2
- package/dist/loop/stepContext.js +2 -2
- package/dist/loop/streamFold.js +3 -3
- package/dist/loop/toolSchema.d.ts +17 -0
- package/dist/loop/toolSchema.js +25 -0
- package/dist/loop/toolSchema.test.d.ts +1 -0
- package/dist/mcp/bridge.d.ts +15 -15
- package/dist/mcp/bridge.js +14 -14
- package/dist/memory/memory-log.entity.d.ts +320 -0
- package/dist/memory/memory-log.entity.functions.d.ts +89 -0
- package/dist/memory/memory-log.entity.functions.js +180 -0
- package/dist/memory/memory-log.entity.js +75 -0
- package/dist/memory/memory-log.entity.test.d.ts +1 -0
- package/dist/memory/memory-session.d.ts +51 -0
- package/dist/memory/memory-session.js +97 -0
- package/dist/memory/memory-session.test.d.ts +1 -0
- package/dist/memory/memory.conformance.d.ts +32 -0
- package/dist/memory/memory.conformance.js +102 -0
- package/dist/ports/auth-store.port.d.ts +16 -18
- package/dist/ports/auth-store.port.js +13 -9
- package/dist/ports/capability.port.d.ts +131 -7
- package/dist/ports/capability.port.js +2 -2
- package/dist/ports/conversation-store.port.d.ts +54 -177
- package/dist/ports/conversation-store.port.js +9 -9
- package/dist/ports/file-system.port.d.ts +5 -7
- package/dist/ports/file-system.port.js +1 -1
- package/dist/ports/harness.port.d.ts +19 -13
- package/dist/ports/harness.port.js +10 -10
- package/dist/ports/mcp-client.port.d.ts +15 -47
- package/dist/ports/mcp-client.port.js +3 -3
- package/dist/ports/memory.port.d.ts +116 -0
- package/dist/ports/memory.port.js +7 -0
- package/dist/ports/model-catalog.port.d.ts +1 -1
- package/dist/ports/model-catalog.port.js +1 -1
- package/dist/ports/permission.port.d.ts +10 -0
- package/dist/ports/permission.port.js +4 -0
- package/dist/ports/run-context.port.d.ts +28 -0
- package/dist/ports/run-context.port.js +4 -0
- package/dist/ports/session-log.port.d.ts +25 -0
- package/dist/ports/session-log.port.js +4 -0
- package/dist/ports/sessions.port.d.ts +141 -0
- package/dist/ports/sessions.port.js +4 -0
- package/dist/ports/settings-store.port.d.ts +18 -56
- package/dist/ports/settings-store.port.js +3 -3
- package/dist/ports/shell.port.d.ts +9 -21
- package/dist/ports/shell.port.js +1 -1
- package/dist/ports/step-loop.port.d.ts +85 -0
- package/dist/ports/step-loop.port.js +4 -0
- package/dist/ports/tasks.port.d.ts +59 -0
- package/dist/ports/tasks.port.js +10 -0
- package/dist/ports/tool-registry.port.d.ts +53 -0
- package/dist/ports/tool-registry.port.js +4 -0
- package/dist/ports/turn-admission.port.d.ts +23 -0
- package/dist/ports/turn-admission.port.js +4 -0
- package/dist/ports/turn-events.port.d.ts +55 -0
- package/dist/ports/turn-events.port.js +7 -0
- package/dist/ports/turn-scope.port.d.ts +101 -0
- package/dist/ports/turn-scope.port.js +10 -0
- package/dist/ports/turn.port.d.ts +113 -0
- package/dist/ports/turn.port.js +0 -0
- package/dist/ports/utility-llm.port.d.ts +12 -31
- package/dist/ports/utility-llm.port.js +1 -1
- package/dist/session/chassis.js +7 -7
- package/dist/session/session-event.entity.d.ts +55 -0
- package/dist/session/session-event.entity.functions.d.ts +31 -0
- package/dist/session/session-event.entity.functions.js +42 -0
- package/dist/session/session-event.entity.js +37 -0
- package/dist/session/session-event.entity.test.d.ts +1 -0
- package/dist/session/session-log.conformance.d.ts +13 -0
- package/dist/session/session-log.conformance.js +167 -0
- package/dist/session/session-log.entity.d.ts +164 -0
- package/dist/session/session-log.entity.js +82 -0
- package/dist/session/session-log.memory.adapter.d.ts +7 -0
- package/dist/session/session-log.memory.adapter.js +82 -0
- package/dist/session/session-log.memory.adapter.test.d.ts +1 -0
- package/dist/session/sessions.entity.d.ts +201 -0
- package/dist/session/sessions.entity.js +98 -0
- package/dist/session/tasks.entity.d.ts +39 -0
- package/dist/session/tasks.entity.js +26 -0
- package/dist/session/turn-admission.open.adapter.d.ts +4 -0
- package/dist/session/turn-admission.open.adapter.js +3 -0
- package/dist/spec/SpecDoc.d.ts +30 -117
- package/dist/spec/SpecDoc.js +10 -10
- package/dist/spec/codec.js +1 -1
- package/dist/turn/model-request.entity.d.ts +99 -0
- package/dist/turn/model-request.entity.functions.d.ts +108 -0
- package/dist/turn/model-request.entity.functions.js +167 -0
- package/dist/turn/model-request.entity.js +41 -0
- package/dist/turn/model-request.entity.test.d.ts +1 -0
- package/dist/turn/prompt-sections.d.ts +10 -0
- package/dist/turn/prompt-sections.js +3 -0
- package/dist/turn/step-loop.conformance.d.ts +16 -0
- package/dist/turn/step-loop.conformance.js +164 -0
- package/dist/turn/testing.d.ts +30 -0
- package/dist/turn/turn-bus.d.ts +23 -0
- package/dist/turn/turn-bus.js +54 -0
- package/dist/turn/turn-bus.test.d.ts +1 -0
- package/dist/turn/turn-event.entity.d.ts +263 -0
- package/dist/turn/turn-event.entity.functions.d.ts +35 -0
- package/dist/turn/turn-event.entity.functions.js +21 -0
- package/dist/turn/turn-event.entity.js +101 -0
- package/dist/turn/turn-lifecycle.d.ts +32 -0
- package/dist/turn/turn-lifecycle.js +48 -0
- package/dist/turn/turn-run.d.ts +26 -0
- package/dist/turn/turn-run.js +105 -0
- package/dist/turn/turn.adapter.d.ts +21 -0
- package/dist/turn/turn.adapter.js +126 -0
- package/dist/turn/turn.adapter.test.d.ts +1 -0
- package/dist/turn/turn.conformance.d.ts +20 -0
- package/dist/turn/turn.conformance.js +74 -0
- package/dist/turn/user-message.entity.d.ts +14 -0
- package/dist/turn/user-message.entity.js +10 -0
- package/dist/util/json.d.ts +2 -2
- package/dist/util/json.js +10 -10
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { Effect } from "effect";
|
|
3
|
+
declare const ConformanceFailure_base: Schema.Class<ConformanceFailure, Schema.TaggedStruct<"ConformanceFailure", {
|
|
4
|
+
readonly check: Schema.String;
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
/** A port contract that an implementation broke. */
|
|
8
|
+
export declare class ConformanceFailure extends ConformanceFailure_base {
|
|
9
|
+
}
|
|
10
|
+
/** One contract check of a conformance kit, runnable under any test runner. */
|
|
11
|
+
export interface ConformanceCheck {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly run: Effect.Effect<void, ConformanceFailure>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const DecisionId: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
3
|
+
export declare const DecisionRecord: Schema.Struct<{
|
|
4
|
+
readonly version: Schema.Literal<1>;
|
|
5
|
+
readonly id: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
6
|
+
readonly family: Schema.NonEmptyString;
|
|
7
|
+
readonly contextHash: Schema.String;
|
|
8
|
+
readonly candidateHash: Schema.String;
|
|
9
|
+
readonly policyVersion: Schema.String;
|
|
10
|
+
readonly candidates: Schema.$Array<Schema.Struct<{
|
|
11
|
+
readonly id: Schema.String;
|
|
12
|
+
readonly description: Schema.String;
|
|
13
|
+
}>>;
|
|
14
|
+
readonly attempts: Schema.$Array<Schema.String>;
|
|
15
|
+
readonly selection: Schema.OptionFromNullOr<Schema.String>;
|
|
16
|
+
readonly validation: Schema.Literals<readonly ["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
|
|
17
|
+
readonly fallback: Schema.OptionFromNullOr<Schema.String>;
|
|
18
|
+
readonly applied: Schema.OptionFromNullOr<Schema.String>;
|
|
19
|
+
readonly probabilities: Schema.OptionFromNullOr<Schema.$Record<Schema.String, Schema.Number>>;
|
|
20
|
+
}>;
|
|
21
|
+
export type DecisionRecord = typeof DecisionRecord.Type;
|
|
22
|
+
export declare const DecisionOutcome: Schema.Struct<{
|
|
23
|
+
readonly version: Schema.Literal<1>;
|
|
24
|
+
readonly decisionId: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
25
|
+
readonly runId: Schema.String;
|
|
26
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "incomplete"]>;
|
|
27
|
+
readonly toolInvocations: Schema.$Array<Schema.String>;
|
|
28
|
+
readonly modelAttempts: Schema.$Array<Schema.String>;
|
|
29
|
+
readonly deliveredSequences: Schema.$Array<Schema.Int>;
|
|
30
|
+
}>;
|
|
31
|
+
export type DecisionOutcome = typeof DecisionOutcome.Type;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { HarnessError } from "./harness/plugin.entity.js";
|
|
3
|
+
import { RunContext } from "./ports/run-context.port.js";
|
|
4
|
+
import type { DecisionRecord } from "./decision-record.entity.js";
|
|
5
|
+
/** Journal a decision on the current turn's bus (`decision.recorded`). */
|
|
6
|
+
export declare const recordDecision: (record: DecisionRecord) => Effect.Effect<void, HarnessError, RunContext>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export const DecisionId = Schema.Trimmed.check(Schema.isNonEmpty()).pipe(Schema.brand("DecisionId")), DecisionRecord = Schema.Struct({
|
|
3
|
+
version: Schema.Literal(1),
|
|
4
|
+
id: DecisionId,
|
|
5
|
+
family: Schema.NonEmptyString,
|
|
6
|
+
contextHash: Schema.String,
|
|
7
|
+
candidateHash: Schema.String,
|
|
8
|
+
policyVersion: Schema.String,
|
|
9
|
+
candidates: Schema.Array(Schema.Struct({ id: Schema.String, description: Schema.String })),
|
|
10
|
+
attempts: Schema.Array(Schema.String),
|
|
11
|
+
selection: Schema.OptionFromNullOr(Schema.String),
|
|
12
|
+
validation: Schema.Literals(["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]),
|
|
13
|
+
fallback: Schema.OptionFromNullOr(Schema.String),
|
|
14
|
+
applied: Schema.OptionFromNullOr(Schema.String),
|
|
15
|
+
probabilities: Schema.OptionFromNullOr(Schema.Record(Schema.String, Schema.Number.pipe(Schema.check(Schema.isBetween({ minimum: 0, maximum: 1 })))))
|
|
16
|
+
}), DecisionOutcome = Schema.Struct({
|
|
17
|
+
version: Schema.Literal(1),
|
|
18
|
+
decisionId: DecisionId,
|
|
19
|
+
runId: Schema.String,
|
|
20
|
+
status: Schema.Literals(["completed", "failed", "cancelled", "incomplete"]),
|
|
21
|
+
toolInvocations: Schema.Array(Schema.String),
|
|
22
|
+
modelAttempts: Schema.Array(Schema.String),
|
|
23
|
+
deliveredSequences: Schema.Array(Schema.Int)
|
|
24
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
/** Stable, serializable failure context shared by products and evaluations. */
|
|
3
|
-
export declare const AgentFailureCategory: Schema.
|
|
3
|
+
export declare const AgentFailureCategory: Schema.Literals<readonly ["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
|
|
4
4
|
export type AgentFailureCategory = typeof AgentFailureCategory.Type;
|
|
5
5
|
export declare const AgentFailure: Schema.Struct<{
|
|
6
|
-
code:
|
|
7
|
-
category: Schema.
|
|
8
|
-
stage:
|
|
9
|
-
message:
|
|
10
|
-
retryable:
|
|
6
|
+
readonly code: Schema.String;
|
|
7
|
+
readonly category: Schema.Literals<readonly ["authentication", "authorization", "rate-limit", "timeout", "transport", "protocol", "validation", "tool", "persistence", "unknown"]>;
|
|
8
|
+
readonly stage: Schema.String;
|
|
9
|
+
readonly message: Schema.String;
|
|
10
|
+
readonly retryable: Schema.Boolean;
|
|
11
11
|
}>;
|
|
12
12
|
export type AgentFailure = typeof AgentFailure.Type;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export const AgentFailureCategory = Schema.
|
|
2
|
+
export const AgentFailureCategory = Schema.Literals([
|
|
3
|
+
"authentication",
|
|
4
|
+
"authorization",
|
|
5
|
+
"rate-limit",
|
|
6
|
+
"timeout",
|
|
7
|
+
"transport",
|
|
8
|
+
"protocol",
|
|
9
|
+
"validation",
|
|
10
|
+
"tool",
|
|
11
|
+
"persistence",
|
|
12
|
+
"unknown"
|
|
13
|
+
]), AgentFailure = Schema.Struct({
|
|
3
14
|
code: Schema.String,
|
|
4
15
|
category: AgentFailureCategory,
|
|
5
16
|
stage: Schema.String,
|
|
@@ -6,7 +6,7 @@ import { Schema } from "effect";
|
|
|
6
6
|
* `message` says exactly what to fix; the model corrects in the same run.
|
|
7
7
|
*/
|
|
8
8
|
export declare const Failure: Schema.Struct<{
|
|
9
|
-
error:
|
|
10
|
-
message:
|
|
9
|
+
readonly error: Schema.String;
|
|
10
|
+
readonly message: Schema.String;
|
|
11
11
|
}>;
|
|
12
12
|
export type Failure = typeof Failure.Type;
|
|
@@ -67,6 +67,8 @@ export type LoopEvent = {
|
|
|
67
67
|
readonly args: unknown;
|
|
68
68
|
readonly ok: boolean;
|
|
69
69
|
readonly result: unknown;
|
|
70
|
+
/** The schema-encoded result — the persisted, provider-visible form. */
|
|
71
|
+
readonly encoded?: unknown;
|
|
70
72
|
}
|
|
71
73
|
/** The mid-run fold: the buffer outgrew the healthy context range and the
|
|
72
74
|
* older turns were replaced by a handoff summary — `kept` verbatim
|
|
@@ -5,140 +5,127 @@ import { Schema } from "effect";
|
|
|
5
5
|
* an opaque blob that round-trips provider-private fields (e.g. Gemini's
|
|
6
6
|
* `thought_signature` on a reasoning part) without the engine inspecting them.
|
|
7
7
|
*/
|
|
8
|
-
export declare const ConversationId: Schema.brand<
|
|
8
|
+
export declare const ConversationId: Schema.brand<Schema.String, "ConversationId">;
|
|
9
9
|
export type ConversationId = typeof ConversationId.Type;
|
|
10
10
|
/** A tool call's pairing key — the provider's id, or the loop's deterministic
|
|
11
11
|
* `<turnIndex>:<toolName>:<ordinal>` mint when the provider omits one. */
|
|
12
|
-
export declare const ToolCallId: Schema.brand<
|
|
12
|
+
export declare const ToolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
13
13
|
export type ToolCallId = typeof ToolCallId.Type;
|
|
14
|
-
declare const Checkpoint_base: Schema.Class<Checkpoint, {
|
|
15
|
-
conversationId: Schema.brand<
|
|
14
|
+
declare const Checkpoint_base: Schema.Class<Checkpoint, Schema.Struct<{
|
|
15
|
+
readonly conversationId: Schema.brand<Schema.String, "ConversationId">;
|
|
16
16
|
/** The absolute message position this fold covers (inclusive). */
|
|
17
|
-
messagePosition:
|
|
18
|
-
summary:
|
|
19
|
-
createdAt:
|
|
20
|
-
}
|
|
21
|
-
conversationId: Schema.brand<typeof Schema.UUID, "ConversationId">;
|
|
22
|
-
/** The absolute message position this fold covers (inclusive). */
|
|
23
|
-
messagePosition: typeof Schema.Number;
|
|
24
|
-
summary: typeof Schema.String;
|
|
25
|
-
createdAt: typeof Schema.Number;
|
|
26
|
-
}>, never, {
|
|
27
|
-
readonly conversationId: string & import("effect/Brand").Brand<"ConversationId">;
|
|
28
|
-
} & {
|
|
29
|
-
readonly messagePosition: number;
|
|
30
|
-
} & {
|
|
31
|
-
readonly summary: string;
|
|
32
|
-
} & {
|
|
33
|
-
readonly createdAt: number;
|
|
34
|
-
}, {}, {}>;
|
|
17
|
+
readonly messagePosition: Schema.Number;
|
|
18
|
+
readonly summary: Schema.String;
|
|
19
|
+
readonly createdAt: Schema.Number;
|
|
20
|
+
}>, {}>;
|
|
35
21
|
export declare class Checkpoint extends Checkpoint_base {
|
|
36
22
|
}
|
|
37
23
|
export declare const TextPart: Schema.Struct<{
|
|
38
|
-
type: Schema.Literal<
|
|
39
|
-
text:
|
|
40
|
-
providerOptions: Schema.optional<
|
|
24
|
+
readonly type: Schema.Literal<"text">;
|
|
25
|
+
readonly text: Schema.String;
|
|
26
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
41
27
|
}>;
|
|
42
28
|
export type TextPart = typeof TextPart.Type;
|
|
43
29
|
export declare const ReasoningPart: Schema.Struct<{
|
|
44
|
-
type: Schema.Literal<
|
|
45
|
-
text:
|
|
46
|
-
providerOptions: Schema.optional<
|
|
30
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
31
|
+
readonly text: Schema.String;
|
|
32
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
47
33
|
}>;
|
|
48
34
|
export type ReasoningPart = typeof ReasoningPart.Type;
|
|
49
35
|
export declare const ToolCallPart: Schema.Struct<{
|
|
50
|
-
type: Schema.Literal<
|
|
51
|
-
toolCallId: Schema.brand<
|
|
52
|
-
toolName:
|
|
53
|
-
input:
|
|
54
|
-
providerOptions: Schema.optional<
|
|
55
|
-
providerExecuted: Schema.optional<
|
|
36
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
37
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
38
|
+
readonly toolName: Schema.String;
|
|
39
|
+
readonly input: Schema.Unknown;
|
|
40
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
41
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
56
42
|
}>;
|
|
57
43
|
export type ToolCallPart = typeof ToolCallPart.Type;
|
|
58
44
|
export declare const ToolResultPart: Schema.Struct<{
|
|
59
|
-
type: Schema.Literal<
|
|
60
|
-
toolCallId: Schema.brand<
|
|
61
|
-
toolName:
|
|
62
|
-
output:
|
|
63
|
-
providerOptions: Schema.optional<
|
|
64
|
-
isError: Schema.optional<
|
|
45
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
46
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
47
|
+
readonly toolName: Schema.String;
|
|
48
|
+
readonly output: Schema.Unknown;
|
|
49
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
50
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
65
51
|
}>;
|
|
66
52
|
export type ToolResultPart = typeof ToolResultPart.Type;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
/** A model-visible message in the user role (the user's own words, turn context, host notes). */
|
|
54
|
+
export declare const UserRoleMessage: Schema.Struct<{
|
|
55
|
+
readonly role: Schema.Literal<"user">;
|
|
56
|
+
readonly content: Schema.String;
|
|
57
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
71
58
|
}>;
|
|
72
|
-
export type
|
|
59
|
+
export type UserRoleMessage = typeof UserRoleMessage.Type;
|
|
73
60
|
export declare const AssistantMessage: Schema.Struct<{
|
|
74
|
-
role: Schema.Literal<
|
|
75
|
-
content: Schema
|
|
76
|
-
type: Schema.Literal<
|
|
77
|
-
text:
|
|
78
|
-
providerOptions: Schema.optional<
|
|
61
|
+
readonly role: Schema.Literal<"assistant">;
|
|
62
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
63
|
+
readonly type: Schema.Literal<"text">;
|
|
64
|
+
readonly text: Schema.String;
|
|
65
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
79
66
|
}>, Schema.Struct<{
|
|
80
|
-
type: Schema.Literal<
|
|
81
|
-
text:
|
|
82
|
-
providerOptions: Schema.optional<
|
|
67
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
68
|
+
readonly text: Schema.String;
|
|
69
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
83
70
|
}>, Schema.Struct<{
|
|
84
|
-
type: Schema.Literal<
|
|
85
|
-
toolCallId: Schema.brand<
|
|
86
|
-
toolName:
|
|
87
|
-
input:
|
|
88
|
-
providerOptions: Schema.optional<
|
|
89
|
-
providerExecuted: Schema.optional<
|
|
71
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
72
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
73
|
+
readonly toolName: Schema.String;
|
|
74
|
+
readonly input: Schema.Unknown;
|
|
75
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
76
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
90
77
|
}>]>>;
|
|
91
|
-
providerOptions: Schema.optional<
|
|
78
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
92
79
|
}>;
|
|
93
80
|
export type AssistantMessage = typeof AssistantMessage.Type;
|
|
94
81
|
export declare const ToolMessage: Schema.Struct<{
|
|
95
|
-
role: Schema.Literal<
|
|
96
|
-
content: Schema
|
|
97
|
-
type: Schema.Literal<
|
|
98
|
-
toolCallId: Schema.brand<
|
|
99
|
-
toolName:
|
|
100
|
-
output:
|
|
101
|
-
providerOptions: Schema.optional<
|
|
102
|
-
isError: Schema.optional<
|
|
82
|
+
readonly role: Schema.Literal<"tool">;
|
|
83
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
84
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
85
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
86
|
+
readonly toolName: Schema.String;
|
|
87
|
+
readonly output: Schema.Unknown;
|
|
88
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
89
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
103
90
|
}>>;
|
|
104
|
-
providerOptions: Schema.optional<
|
|
91
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
105
92
|
}>;
|
|
106
93
|
export type ToolMessage = typeof ToolMessage.Type;
|
|
107
94
|
/** The single conversation unit — persisted as-is, one row per entry. */
|
|
108
|
-
export declare const AgentMessage: Schema.Union<[Schema.Struct<{
|
|
109
|
-
role: Schema.Literal<
|
|
110
|
-
content:
|
|
111
|
-
providerOptions: Schema.optional<
|
|
95
|
+
export declare const AgentMessage: Schema.Union<readonly [Schema.Struct<{
|
|
96
|
+
readonly role: Schema.Literal<"user">;
|
|
97
|
+
readonly content: Schema.String;
|
|
98
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
112
99
|
}>, Schema.Struct<{
|
|
113
|
-
role: Schema.Literal<
|
|
114
|
-
content: Schema
|
|
115
|
-
type: Schema.Literal<
|
|
116
|
-
text:
|
|
117
|
-
providerOptions: Schema.optional<
|
|
100
|
+
readonly role: Schema.Literal<"assistant">;
|
|
101
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
102
|
+
readonly type: Schema.Literal<"text">;
|
|
103
|
+
readonly text: Schema.String;
|
|
104
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
118
105
|
}>, Schema.Struct<{
|
|
119
|
-
type: Schema.Literal<
|
|
120
|
-
text:
|
|
121
|
-
providerOptions: Schema.optional<
|
|
106
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
107
|
+
readonly text: Schema.String;
|
|
108
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
122
109
|
}>, Schema.Struct<{
|
|
123
|
-
type: Schema.Literal<
|
|
124
|
-
toolCallId: Schema.brand<
|
|
125
|
-
toolName:
|
|
126
|
-
input:
|
|
127
|
-
providerOptions: Schema.optional<
|
|
128
|
-
providerExecuted: Schema.optional<
|
|
110
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
111
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
112
|
+
readonly toolName: Schema.String;
|
|
113
|
+
readonly input: Schema.Unknown;
|
|
114
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
115
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
129
116
|
}>]>>;
|
|
130
|
-
providerOptions: Schema.optional<
|
|
117
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
131
118
|
}>, Schema.Struct<{
|
|
132
|
-
role: Schema.Literal<
|
|
133
|
-
content: Schema
|
|
134
|
-
type: Schema.Literal<
|
|
135
|
-
toolCallId: Schema.brand<
|
|
136
|
-
toolName:
|
|
137
|
-
output:
|
|
138
|
-
providerOptions: Schema.optional<
|
|
139
|
-
isError: Schema.optional<
|
|
119
|
+
readonly role: Schema.Literal<"tool">;
|
|
120
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
121
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
122
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
123
|
+
readonly toolName: Schema.String;
|
|
124
|
+
readonly output: Schema.Unknown;
|
|
125
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
126
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
140
127
|
}>>;
|
|
141
|
-
providerOptions: Schema.optional<
|
|
128
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
142
129
|
}>]>;
|
|
143
130
|
export type AgentMessage = typeof AgentMessage.Type;
|
|
144
131
|
/**
|
|
@@ -147,81 +134,81 @@ export type AgentMessage = typeof AgentMessage.Type;
|
|
|
147
134
|
* never reconstruct it by index arithmetic on `messages`.
|
|
148
135
|
*/
|
|
149
136
|
export declare const AgentResult: Schema.Struct<{
|
|
150
|
-
finalText:
|
|
151
|
-
messages: Schema
|
|
152
|
-
role: Schema.Literal<
|
|
153
|
-
content:
|
|
154
|
-
providerOptions: Schema.optional<
|
|
137
|
+
readonly finalText: Schema.String;
|
|
138
|
+
readonly messages: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
139
|
+
readonly role: Schema.Literal<"user">;
|
|
140
|
+
readonly content: Schema.String;
|
|
141
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
155
142
|
}>, Schema.Struct<{
|
|
156
|
-
role: Schema.Literal<
|
|
157
|
-
content: Schema
|
|
158
|
-
type: Schema.Literal<
|
|
159
|
-
text:
|
|
160
|
-
providerOptions: Schema.optional<
|
|
143
|
+
readonly role: Schema.Literal<"assistant">;
|
|
144
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
145
|
+
readonly type: Schema.Literal<"text">;
|
|
146
|
+
readonly text: Schema.String;
|
|
147
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
161
148
|
}>, Schema.Struct<{
|
|
162
|
-
type: Schema.Literal<
|
|
163
|
-
text:
|
|
164
|
-
providerOptions: Schema.optional<
|
|
149
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
150
|
+
readonly text: Schema.String;
|
|
151
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
165
152
|
}>, Schema.Struct<{
|
|
166
|
-
type: Schema.Literal<
|
|
167
|
-
toolCallId: Schema.brand<
|
|
168
|
-
toolName:
|
|
169
|
-
input:
|
|
170
|
-
providerOptions: Schema.optional<
|
|
171
|
-
providerExecuted: Schema.optional<
|
|
153
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
154
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
155
|
+
readonly toolName: Schema.String;
|
|
156
|
+
readonly input: Schema.Unknown;
|
|
157
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
158
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
172
159
|
}>]>>;
|
|
173
|
-
providerOptions: Schema.optional<
|
|
160
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
174
161
|
}>, Schema.Struct<{
|
|
175
|
-
role: Schema.Literal<
|
|
176
|
-
content: Schema
|
|
177
|
-
type: Schema.Literal<
|
|
178
|
-
toolCallId: Schema.brand<
|
|
179
|
-
toolName:
|
|
180
|
-
output:
|
|
181
|
-
providerOptions: Schema.optional<
|
|
182
|
-
isError: Schema.optional<
|
|
162
|
+
readonly role: Schema.Literal<"tool">;
|
|
163
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
164
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
165
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
166
|
+
readonly toolName: Schema.String;
|
|
167
|
+
readonly output: Schema.Unknown;
|
|
168
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
169
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
183
170
|
}>>;
|
|
184
|
-
providerOptions: Schema.optional<
|
|
171
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
185
172
|
}>]>>;
|
|
186
|
-
newTail: Schema
|
|
187
|
-
role: Schema.Literal<
|
|
188
|
-
content:
|
|
189
|
-
providerOptions: Schema.optional<
|
|
173
|
+
readonly newTail: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
174
|
+
readonly role: Schema.Literal<"user">;
|
|
175
|
+
readonly content: Schema.String;
|
|
176
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
190
177
|
}>, Schema.Struct<{
|
|
191
|
-
role: Schema.Literal<
|
|
192
|
-
content: Schema
|
|
193
|
-
type: Schema.Literal<
|
|
194
|
-
text:
|
|
195
|
-
providerOptions: Schema.optional<
|
|
178
|
+
readonly role: Schema.Literal<"assistant">;
|
|
179
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
180
|
+
readonly type: Schema.Literal<"text">;
|
|
181
|
+
readonly text: Schema.String;
|
|
182
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
196
183
|
}>, Schema.Struct<{
|
|
197
|
-
type: Schema.Literal<
|
|
198
|
-
text:
|
|
199
|
-
providerOptions: Schema.optional<
|
|
184
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
185
|
+
readonly text: Schema.String;
|
|
186
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
200
187
|
}>, Schema.Struct<{
|
|
201
|
-
type: Schema.Literal<
|
|
202
|
-
toolCallId: Schema.brand<
|
|
203
|
-
toolName:
|
|
204
|
-
input:
|
|
205
|
-
providerOptions: Schema.optional<
|
|
206
|
-
providerExecuted: Schema.optional<
|
|
188
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
189
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
190
|
+
readonly toolName: Schema.String;
|
|
191
|
+
readonly input: Schema.Unknown;
|
|
192
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
193
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
207
194
|
}>]>>;
|
|
208
|
-
providerOptions: Schema.optional<
|
|
195
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
209
196
|
}>, Schema.Struct<{
|
|
210
|
-
role: Schema.Literal<
|
|
211
|
-
content: Schema
|
|
212
|
-
type: Schema.Literal<
|
|
213
|
-
toolCallId: Schema.brand<
|
|
214
|
-
toolName:
|
|
215
|
-
output:
|
|
216
|
-
providerOptions: Schema.optional<
|
|
217
|
-
isError: Schema.optional<
|
|
197
|
+
readonly role: Schema.Literal<"tool">;
|
|
198
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
199
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
200
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
201
|
+
readonly toolName: Schema.String;
|
|
202
|
+
readonly output: Schema.Unknown;
|
|
203
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
204
|
+
readonly isError: Schema.optional<Schema.Boolean>;
|
|
218
205
|
}>>;
|
|
219
|
-
providerOptions: Schema.optional<
|
|
206
|
+
readonly providerOptions: Schema.optional<Schema.Unknown>;
|
|
220
207
|
}>]>>;
|
|
221
208
|
/** "ok" — the model finished on its own; "partial" — the step cap or the
|
|
222
209
|
* degenerate-loop breaker stopped it, so `finalText` is NOT a deliverable. */
|
|
223
|
-
outcome: Schema.
|
|
224
|
-
reason: Schema.
|
|
210
|
+
readonly outcome: Schema.Literals<readonly ["ok", "partial"]>;
|
|
211
|
+
readonly reason: Schema.Literals<readonly ["completed", "step-cap", "degenerate-loop"]>;
|
|
225
212
|
}>;
|
|
226
213
|
export type AgentResult = typeof AgentResult.Type;
|
|
227
214
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export const ConversationId = Schema.
|
|
2
|
+
export const ConversationId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("ConversationId")), ToolCallId = Schema.String.pipe(Schema.brand("ToolCallId"));
|
|
3
3
|
|
|
4
4
|
export class Checkpoint extends Schema.Class("Checkpoint")({
|
|
5
5
|
conversationId: ConversationId,
|
|
@@ -30,22 +30,22 @@ export const TextPart = Schema.Struct({
|
|
|
30
30
|
output: Schema.Unknown,
|
|
31
31
|
providerOptions: Schema.optional(Schema.Unknown),
|
|
32
32
|
isError: Schema.optional(Schema.Boolean)
|
|
33
|
-
}),
|
|
33
|
+
}), UserRoleMessage = Schema.Struct({
|
|
34
34
|
role: Schema.Literal("user"),
|
|
35
35
|
content: Schema.String,
|
|
36
36
|
providerOptions: Schema.optional(Schema.Unknown)
|
|
37
37
|
}), AssistantMessage = Schema.Struct({
|
|
38
38
|
role: Schema.Literal("assistant"),
|
|
39
|
-
content: Schema.Array(Schema.Union(TextPart, ReasoningPart, ToolCallPart)),
|
|
39
|
+
content: Schema.Array(Schema.Union([TextPart, ReasoningPart, ToolCallPart])),
|
|
40
40
|
providerOptions: Schema.optional(Schema.Unknown)
|
|
41
41
|
}), ToolMessage = Schema.Struct({
|
|
42
42
|
role: Schema.Literal("tool"),
|
|
43
43
|
content: Schema.Array(ToolResultPart),
|
|
44
44
|
providerOptions: Schema.optional(Schema.Unknown)
|
|
45
|
-
}), AgentMessage = Schema.Union(
|
|
45
|
+
}), AgentMessage = Schema.Union([UserRoleMessage, AssistantMessage, ToolMessage]), AgentResult = Schema.Struct({
|
|
46
46
|
finalText: Schema.String,
|
|
47
47
|
messages: Schema.Array(AgentMessage),
|
|
48
48
|
newTail: Schema.Array(AgentMessage),
|
|
49
|
-
outcome: Schema.
|
|
50
|
-
reason: Schema.
|
|
49
|
+
outcome: Schema.Literals(["ok", "partial"]),
|
|
50
|
+
reason: Schema.Literals(["completed", "step-cap", "degenerate-loop"])
|
|
51
51
|
});
|
|
@@ -3,10 +3,10 @@ import { Schema } from "effect";
|
|
|
3
3
|
* subscription dialect (accepted, reasoning_tokens 0); `minimal` was
|
|
4
4
|
* REJECTED there and stays out of the vocabulary. Non-codex adapters clamp
|
|
5
5
|
* `none` to their nearest supported value. */
|
|
6
|
-
export declare const ReasoningEffort: Schema.
|
|
6
|
+
export declare const ReasoningEffort: Schema.Literals<readonly ["none", "low", "medium", "high", "xhigh", "max"]>;
|
|
7
7
|
export type ReasoningEffort = typeof ReasoningEffort.Type;
|
|
8
8
|
export declare const ModelCallPolicy: Schema.Struct<{
|
|
9
|
-
effort: Schema.
|
|
10
|
-
maxOutputTokens: Schema.optional<
|
|
9
|
+
readonly effort: Schema.Literals<readonly ["none", "low", "medium", "high", "xhigh", "max"]>;
|
|
10
|
+
readonly maxOutputTokens: Schema.optional<Schema.Number>;
|
|
11
11
|
}>;
|
|
12
12
|
export type ModelCallPolicy = typeof ModelCallPolicy.Type;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export const ReasoningEffort = Schema.
|
|
2
|
+
export const ReasoningEffort = Schema.Literals(["none", "low", "medium", "high", "xhigh", "max"]), ModelCallPolicy = Schema.Struct({
|
|
3
3
|
effort: ReasoningEffort,
|
|
4
4
|
maxOutputTokens: Schema.optional(Schema.Number)
|
|
5
5
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
/** A selectable model exposed by one configured provider adapter. */
|
|
3
3
|
export declare const ModelCatalogEntry: Schema.Struct<{
|
|
4
|
-
selection:
|
|
4
|
+
readonly selection: Schema.String;
|
|
5
5
|
/** Human-facing route name. `selection` remains the stable persisted id. */
|
|
6
|
-
label: Schema.optional<
|
|
7
|
-
provider:
|
|
8
|
-
credential: Schema.
|
|
6
|
+
readonly label: Schema.optional<Schema.String>;
|
|
7
|
+
readonly provider: Schema.String;
|
|
8
|
+
readonly credential: Schema.Literals<readonly ["api_key", "oauth", "local"]>;
|
|
9
9
|
}>;
|
|
10
10
|
export type ModelCatalogEntry = typeof ModelCatalogEntry.Type;
|