@yolk-sdk/connectors 0.1.0-canary.113 → 0.1.0-canary.115
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 +11 -3
- package/dist/action.d.mts +34 -3
- package/dist/action.d.mts.map +1 -1
- package/dist/action.mjs +9 -1
- package/dist/action.mjs.map +1 -1
- package/dist/agent.d.mts +3 -1
- package/dist/agent.d.mts.map +1 -1
- package/dist/agent.mjs +35 -12
- package/dist/agent.mjs.map +1 -1
- package/dist/email/index.d.mts +6 -1
- package/dist/email/index.d.mts.map +1 -1
- package/dist/email/index.mjs +19 -2
- package/dist/email/index.mjs.map +1 -1
- package/dist/file-output.d.mts +17 -0
- package/dist/file-output.d.mts.map +1 -0
- package/dist/file-output.mjs +102 -0
- package/dist/file-output.mjs.map +1 -0
- package/dist/fortnox/files.d.mts +2 -2
- package/dist/fortnox/inbox.d.mts +1 -1
- package/dist/fortnox/index.d.mts +18 -18
- package/dist/fortnox/offers.d.mts +45 -45
- package/dist/fortnox/payments.d.mts +44 -44
- package/dist/fortnox/settings-registers.d.mts +4 -4
- package/dist/fortnox/transfer.d.mts +1 -1
- package/dist/fortnox/transfer.d.mts.map +1 -1
- package/dist/github/conformance/cases.d.mts +1 -1
- package/dist/github/index.d.mts +1 -1
- package/dist/github/issues.d.mts +2 -2
- package/dist/google/conformance/shared.d.mts +4 -4
- package/dist/google/drive-download.d.mts +2 -2
- package/dist/google/drive.d.mts +16 -16
- package/dist/google/gmail-download.d.mts +1 -1
- package/dist/google/gmail.d.mts +21 -8
- package/dist/google/gmail.d.mts.map +1 -1
- package/dist/google/gmail.mjs +37 -5
- package/dist/google/gmail.mjs.map +1 -1
- package/dist/google/index.d.mts +2 -2
- package/dist/google/index.d.mts.map +1 -1
- package/dist/google/index.mjs +2 -2
- package/dist/google/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/microsoft/conformance/cases.d.mts +3 -3
- package/dist/microsoft/index.d.mts +2 -2
- package/dist/microsoft/index.d.mts.map +1 -1
- package/dist/microsoft/index.mjs +2 -2
- package/dist/microsoft/index.mjs.map +1 -1
- package/dist/microsoft/mail-download.d.mts +1 -1
- package/dist/microsoft/mail.d.mts +6 -1
- package/dist/microsoft/mail.d.mts.map +1 -1
- package/dist/microsoft/mail.mjs +19 -2
- package/dist/microsoft/mail.mjs.map +1 -1
- package/dist/notion/conformance/cases.d.mts +3 -3
- package/dist/r2-storage/conformance/cases.d.mts +1 -1
- package/dist/telegram/conformance/cases.d.mts +1 -1
- package/dist/telegram/download.d.mts +1 -1
- package/dist/todoist/files.d.mts +1 -1
- package/dist/todoist/index.d.mts +2 -2
- package/dist/todoist/index.d.mts.map +1 -1
- package/package.json +4 -4
- package/src/action.ts +48 -1
- package/src/agent.ts +69 -25
- package/src/email/index.ts +29 -1
- package/src/file-output.ts +78 -0
- package/src/google/gmail.ts +71 -11
- package/src/google/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/microsoft/index.ts +1 -0
- package/src/microsoft/mail.ts +29 -1
package/README.md
CHANGED
|
@@ -68,6 +68,12 @@ import { GoogleConnector } from '@yolk-sdk/connectors/google'
|
|
|
68
68
|
- **R2ObjectClient**: host-provided conditional object port for R2 get/create/update.
|
|
69
69
|
- **ConnectorFileTransferBudget**: host-owned streamed byte/metadata/error limits for those helpers.
|
|
70
70
|
- **EmailClient**: host-provided IMAP, POP3, and SMTP transport port used by generic email actions.
|
|
71
|
+
- **fileOutput**: optional on an action whose output carries file bytes (ADR 0009): a byte-free
|
|
72
|
+
`schema` (the agent tool output) and `split` into that value plus `ConnectorActionFile`s
|
|
73
|
+
(`connectorActionFile`, with `sniffBase64MimeType` for common types). The agent bridge returns
|
|
74
|
+
the bytes as `FilePart`s that tool resolution captures into `fileId`s; `connector.invoke` keeps
|
|
75
|
+
the full output. `gmail.get_attachment`, `outlook.get_attachment` and `email.get_attachment`
|
|
76
|
+
declare it.
|
|
71
77
|
|
|
72
78
|
`makeConnectorToolModule` uses the connector `description` as the module description (override
|
|
73
79
|
with `description`) and returns each action result as the JSON encoding of its `outputSchema`
|
|
@@ -260,7 +266,8 @@ base64 in `contentBase64`; decoded `size` is a non-negative integer. Existing `E
|
|
|
260
266
|
implementations may omit the optional `getAttachment` method; invoking the action then fails with a
|
|
261
267
|
typed validation error. Successful host output is schema-validated at the connector boundary before
|
|
262
268
|
it is returned. Hosts that implement it own MIME parsing, base64 encoding, size policy,
|
|
263
|
-
storage, and content scanning.
|
|
269
|
+
storage, and content scanning. As an agent tool the action returns the attachment as a file
|
|
270
|
+
(`fileId`) with its metadata instead of base64.
|
|
264
271
|
IMAP adapters should fetch parts without marking messages read when supported. POP3 has no standard
|
|
265
272
|
partial-part fetch, so adapters may retrieve the whole stable UIDL-addressed message before
|
|
266
273
|
extracting the part. POP3 rejects `folder` for attachment retrieval just as it does for list/get.
|
|
@@ -483,7 +490,7 @@ metadata. No automatic retry occurs. Hosts must reconcile an unconfirmed send be
|
|
|
483
490
|
another; a deterministic Message-ID does not make sending idempotent. Keep raw sending out of
|
|
484
491
|
model tool allowlists when it is intended only for a host-owned reviewed action.
|
|
485
492
|
|
|
486
|
-
`gmail.get_thread` requires `threadId` and `format: 'full' | 'metadata' | 'minimal'`. It returns `GmailThreadOutput` with normalized messages, selected headers, decoded message text when the provider includes it (Gmail answers `body.data` transfer-decoded, so a part's `Content-Transfer-Encoding` is never applied again), and attachment metadata. Plain text is preferred over HTML; text attachments never become message bodies. Raw MIME and attachment content are omitted. Use `gmail.list_attachments` with one `messageId` for metadata-only discovery without fetching a whole thread; its `attachments` field is an Effect `Chunk`, and metadata includes inline/content-ID details when Gmail supplies them. When an attachment has `attachmentId`, fetch it with `gmail.get_attachment`; the typed output preserves Gmail's `size` and base64url `data` fields and adds standard-base64 `contentBase64` plus the input IDs. Gmail inline attachments may omit `attachmentId` and remain discoverable but cannot be retrieved through that action. Use `full` when decoded bodies are required.
|
|
493
|
+
`gmail.get_thread` requires `threadId` and `format: 'full' | 'metadata' | 'minimal'`. It returns `GmailThreadOutput` with normalized messages, selected headers, decoded message text when the provider includes it (Gmail answers `body.data` transfer-decoded, so a part's `Content-Transfer-Encoding` is never applied again), and attachment metadata. Plain text is preferred over HTML; text attachments never become message bodies. Raw MIME and attachment content are omitted. Use `gmail.list_attachments` with one `messageId` for metadata-only discovery without fetching a whole thread; its `attachments` field is an Effect `Chunk`, and metadata includes inline/content-ID details when Gmail supplies them. When an attachment has `attachmentId`, fetch it with `gmail.get_attachment`; the typed output preserves Gmail's `size` and base64url `data` fields and adds standard-base64 `contentBase64` plus the input IDs. Its optional `filename` and `mimeType` inputs (the values `gmail.list_attachments` reports) are echoed unverified in the output and name the file it yields as an agent tool (`fileOutput`, ADR 0009). Gmail inline attachments may omit `attachmentId` and remain discoverable but cannot be retrieved through that action. Use `full` when decoded bodies are required.
|
|
487
494
|
|
|
488
495
|
`gmail.list_threads` (`gmailListThreadsAction`, read, `gmail.readonly` slot) sends
|
|
489
496
|
`GET /users/me/threads` with the `gmail.list` filters (`GmailListThreadsInput`: `query`, `labelId`,
|
|
@@ -1106,7 +1113,8 @@ expect `contentId` there; fetch the individual file attachment for `cid:` mappin
|
|
|
1106
1113
|
returns those bytes as required `contentBase64`. Item and reference attachments remain available only
|
|
1107
1114
|
as list metadata and are rejected by this action. Both actions use the existing signed-in, shared/delegated, or application `Mail.Read`
|
|
1108
1115
|
permission selection. Base64 content remains in the string/JSON HTTP boundary; hosts own decoding,
|
|
1109
|
-
size policy, durable storage, and content scanning.
|
|
1116
|
+
size policy, durable storage, and content scanning. As an agent tool `outlook.get_attachment`
|
|
1117
|
+
returns the attachment as a file (`fileId`) with its metadata instead of base64.
|
|
1110
1118
|
|
|
1111
1119
|
To add a file to an existing draft (for example one from `outlook.create_draft` or
|
|
1112
1120
|
`outlook.create_reply_draft`) before `outlook.send_draft`, host code calls the host-only
|
package/dist/action.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectorError } from "./error.mjs";
|
|
2
2
|
import { ActionResult } from "./result.mjs";
|
|
3
3
|
import { ConnectorIntegration } from "./integration.mjs";
|
|
4
|
-
import { Effect } from "effect";
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
|
|
7
7
|
//#region src/action.d.ts
|
|
@@ -20,12 +20,42 @@ type UnknownActionExecutionInput = {
|
|
|
20
20
|
readonly integration: ConnectorIntegration;
|
|
21
21
|
readonly input: unknown;
|
|
22
22
|
};
|
|
23
|
+
/** One file an action yields (ADR 0009): standard base64 bytes the agent bridge turns into a
|
|
24
|
+
* `FilePart`, so tool resolution stores them and the model only sees a `fileId`. */
|
|
25
|
+
type ConnectorActionFile = {
|
|
26
|
+
readonly base64: string;
|
|
27
|
+
readonly mimeType: string;
|
|
28
|
+
readonly filename?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* How the agent bridge splits an action output that carries file bytes: `schema` is the
|
|
32
|
+
* model-facing output (the action output without the bytes, declared as the tool output) and
|
|
33
|
+
* `split` returns that value plus the files. `connector.invoke` is unchanged and still returns the
|
|
34
|
+
* full output to hosts.
|
|
35
|
+
*/
|
|
36
|
+
type ConnectorActionFileOutput<Output> = {
|
|
37
|
+
readonly schema: ActionOutputSchema;
|
|
38
|
+
readonly split: (output: Output) => {
|
|
39
|
+
readonly value: unknown;
|
|
40
|
+
readonly files: ReadonlyArray<ConnectorActionFile>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/** `ConnectorActionFileOutput` over an unknown output: `split` is `None` when the value is not
|
|
44
|
+
* the action's output. */
|
|
45
|
+
type UnknownConnectorActionFileOutput = {
|
|
46
|
+
readonly schema: ActionOutputSchema;
|
|
47
|
+
readonly split: (output: unknown) => Option.Option<{
|
|
48
|
+
readonly value: unknown;
|
|
49
|
+
readonly files: ReadonlyArray<ConnectorActionFile>;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
23
52
|
type ConnectorAction<Env = never, Error = never> = {
|
|
24
53
|
readonly id: string;
|
|
25
54
|
readonly description?: string;
|
|
26
55
|
readonly access?: ConnectorActionAccess;
|
|
27
56
|
readonly inputSchema: ActionInputSchema;
|
|
28
57
|
readonly outputSchema: ActionOutputSchema;
|
|
58
|
+
readonly fileOutput?: UnknownConnectorActionFileOutput;
|
|
29
59
|
readonly execute: (input: UnknownActionExecutionInput) => Effect.Effect<ActionResult<unknown>, Error | ConnectorError, Env>;
|
|
30
60
|
};
|
|
31
61
|
type TypedConnectorAction<InputSchema extends ActionInputSchema, Output, Env = never, Error = never> = ConnectorAction<Env, Error> & {
|
|
@@ -44,10 +74,11 @@ type DefineActionOptions<InputSchema extends ActionInputSchema, Output, Env, Err
|
|
|
44
74
|
readonly inputSchema: InputSchema;
|
|
45
75
|
readonly outputSchema: Schema.Schema<Output> & {
|
|
46
76
|
readonly EncodingServices: never;
|
|
47
|
-
};
|
|
77
|
+
}; /** Set when the output carries file bytes (ADR 0009). */
|
|
78
|
+
readonly fileOutput?: ConnectorActionFileOutput<Output>;
|
|
48
79
|
readonly execute: (input: ActionExecutionInput<InputSchema['Type']>) => Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env>;
|
|
49
80
|
};
|
|
50
81
|
declare const defineAction: <InputSchema extends ActionInputSchema, Output, Env = never, Error = never>(options: DefineActionOptions<InputSchema, Output, Env, Error>) => TypedConnectorAction<InputSchema, Output, Env, Error>;
|
|
51
82
|
//#endregion
|
|
52
|
-
export { ActionExecutionInput, ConnectorAction, ConnectorActionAccess, DefineActionOptions, TypedConnectorAction, UnknownActionExecutionInput, defineAction };
|
|
83
|
+
export { ActionExecutionInput, ConnectorAction, ConnectorActionAccess, ConnectorActionFile, ConnectorActionFileOutput, DefineActionOptions, TypedConnectorAction, UnknownActionExecutionInput, UnknownConnectorActionFileOutput, defineAction };
|
|
53
84
|
//# sourceMappingURL=action.d.mts.map
|
package/dist/action.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.mts","names":[],"sources":["../src/action.ts"],"mappings":";;;;;;;KAMK,iBAAA,GAAoB,MAAA,CAAO,MAAM;EAAA,SAAuB,gBAAA;AAAA;AAAA,KAExD,kBAAA,GAAqB,MAAA,CAAO,MAAM;EAAA,SAAuB,gBAAA;AAAA;AAAA,KAElD,qBAAA;AAAA,KAEA,oBAAA;EAAA,SACD,WAAA,EAAa,oBAAA;EAAA,SACb,KAAA,EAAO,KAAK;AAAA;AAAA,KAGX,2BAAA;EAAA,SACD,WAAA,EAAa,oBAAoB;EAAA,SACjC,KAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"action.d.mts","names":[],"sources":["../src/action.ts"],"mappings":";;;;;;;KAMK,iBAAA,GAAoB,MAAA,CAAO,MAAM;EAAA,SAAuB,gBAAA;AAAA;AAAA,KAExD,kBAAA,GAAqB,MAAA,CAAO,MAAM;EAAA,SAAuB,gBAAA;AAAA;AAAA,KAElD,qBAAA;AAAA,KAEA,oBAAA;EAAA,SACD,WAAA,EAAa,oBAAA;EAAA,SACb,KAAA,EAAO,KAAK;AAAA;AAAA,KAGX,2BAAA;EAAA,SACD,WAAA,EAAa,oBAAoB;EAAA,SACjC,KAAA;AAAA;;;KAKC,mBAAA;EAAA,SACD,MAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;AAAA;;;AAjBsB;AAEjC;;;KAwBY,yBAAA;EAAA,SACD,MAAA,EAAQ,kBAAA;EAAA,SACR,KAAA,GAAQ,MAAA,EAAQ,MAAA;IAAA,SACd,KAAA;IAAA,SACA,KAAA,EAAO,aAAA,CAAc,mBAAA;EAAA;AAAA;AA1BX;AAGvB;AAHuB,KAgCX,gCAAA;EAAA,SACD,MAAA,EAAQ,kBAAA;EAAA,SACR,KAAA,GAAQ,MAAA,cAAoB,MAAA,CAAO,MAAA;IAAA,SACjC,KAAA;IAAA,SACA,KAAA,EAAO,aAAA,CAAc,mBAAA;EAAA;AAAA;A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action.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConnectorError } from "./error.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Effect, Option } from "effect";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
//#region src/action.ts
|
|
5
5
|
const validationError = (actionId, error) => new ConnectorError({
|
|
@@ -14,6 +14,14 @@ const defineAction = (options) => (() => {
|
|
|
14
14
|
description: options.description
|
|
15
15
|
};
|
|
16
16
|
if (options.access !== void 0) fields.access = options.access;
|
|
17
|
+
const fileOutput = options.fileOutput;
|
|
18
|
+
if (fileOutput !== void 0) {
|
|
19
|
+
const isOutput = Schema.is(Schema.toType(options.outputSchema));
|
|
20
|
+
fields.fileOutput = {
|
|
21
|
+
schema: fileOutput.schema,
|
|
22
|
+
split: (output) => isOutput(output) ? Option.some(fileOutput.split(output)) : Option.none()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
const run = (input, schema) => Schema.decodeUnknownEffect(schema)(input.input).pipe(Effect.mapError((error) => validationError(options.id, error)), Effect.flatMap((params) => options.execute({
|
|
18
26
|
integration: input.integration,
|
|
19
27
|
input: params
|
package/dist/action.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.mjs","names":[],"sources":["../src/action.ts"],"sourcesContent":["import { Effect } from 'effect'\nimport * as Schema from 'effect/Schema'\nimport { ConnectorError } from './error.ts'\nimport type { ActionResult } from './result.ts'\nimport type { ConnectorIntegration } from './integration.ts'\n\ntype ActionInputSchema = Schema.Schema<unknown> & { readonly DecodingServices: never }\n\ntype ActionOutputSchema = Schema.Schema<unknown> & { readonly EncodingServices: never }\n\nexport type ConnectorActionAccess = 'read' | 'write' | 'destructive'\n\nexport type ActionExecutionInput<Input> = {\n readonly integration: ConnectorIntegration\n readonly input: Input\n}\n\nexport type UnknownActionExecutionInput = {\n readonly integration: ConnectorIntegration\n readonly input: unknown\n}\n\nexport type ConnectorAction<Env = never, Error = never> = {\n readonly id: string\n readonly description?: string\n readonly access?: ConnectorActionAccess\n readonly inputSchema: ActionInputSchema\n readonly outputSchema: ActionOutputSchema\n readonly execute: (\n input: UnknownActionExecutionInput\n ) => Effect.Effect<ActionResult<unknown>, Error | ConnectorError, Env>\n}\n\nexport type TypedConnectorAction<\n InputSchema extends ActionInputSchema,\n Output,\n Env = never,\n Error = never\n> = ConnectorAction<Env, Error> & {\n readonly inputSchema: InputSchema\n readonly outputSchema: Schema.Schema<Output> & { readonly EncodingServices: never }\n /** Validates decoded input on the type side, without replaying wire transforms.\n * Implementations remain responsible for validating external output data. */\n readonly executeTyped: (\n input: ActionExecutionInput<InputSchema['Type']>\n ) => Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env>\n}\n\nexport type DefineActionOptions<InputSchema extends ActionInputSchema, Output, Env, Error> = {\n readonly id: string\n readonly description?: string\n readonly access?: ConnectorActionAccess\n readonly inputSchema: InputSchema\n readonly outputSchema: Schema.Schema<Output> & { readonly EncodingServices: never }\n readonly execute: (\n input: ActionExecutionInput<InputSchema['Type']>\n ) => Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env>\n}\n\nconst validationError = (actionId: string, error: Schema.SchemaError) =>\n new ConnectorError({\n cause: 'validation_failed',\n message: `Invalid input for action: ${actionId}`,\n actionId,\n underlying: error\n })\n\ntype ConnectorActionPrefixFields = {\n readonly id: string\n description?: string\n access?: ConnectorActionAccess\n}\n\nexport const defineAction = <\n InputSchema extends ActionInputSchema,\n Output,\n Env = never,\n Error = never\n>(\n options: DefineActionOptions<InputSchema, Output, Env, Error>\n): TypedConnectorAction<InputSchema, Output, Env, Error> =>\n (() => {\n const fields: ConnectorActionPrefixFields = {\n id: options.id,\n description: options.description\n }\n\n if (options.access !== undefined) {\n fields.access = options.access\n }\n\n const run = (\n input: UnknownActionExecutionInput,\n schema: Schema.Schema<InputSchema['Type']> & { readonly DecodingServices: never }\n ): Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env> =>\n Schema.decodeUnknownEffect(schema)(input.input).pipe(\n Effect.mapError(error => validationError(options.id, error)),\n Effect.flatMap(params =>\n options.execute({\n integration: input.integration,\n input: params\n })\n )\n )\n\n return {\n ...fields,\n inputSchema: options.inputSchema,\n outputSchema: options.outputSchema,\n execute: input => run(input, options.inputSchema),\n executeTyped: input => run(input, Schema.toType(options.inputSchema))\n }\n })()\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"action.mjs","names":[],"sources":["../src/action.ts"],"sourcesContent":["import { Effect, Option } from 'effect'\nimport * as Schema from 'effect/Schema'\nimport { ConnectorError } from './error.ts'\nimport type { ActionResult } from './result.ts'\nimport type { ConnectorIntegration } from './integration.ts'\n\ntype ActionInputSchema = Schema.Schema<unknown> & { readonly DecodingServices: never }\n\ntype ActionOutputSchema = Schema.Schema<unknown> & { readonly EncodingServices: never }\n\nexport type ConnectorActionAccess = 'read' | 'write' | 'destructive'\n\nexport type ActionExecutionInput<Input> = {\n readonly integration: ConnectorIntegration\n readonly input: Input\n}\n\nexport type UnknownActionExecutionInput = {\n readonly integration: ConnectorIntegration\n readonly input: unknown\n}\n\n/** One file an action yields (ADR 0009): standard base64 bytes the agent bridge turns into a\n * `FilePart`, so tool resolution stores them and the model only sees a `fileId`. */\nexport type ConnectorActionFile = {\n readonly base64: string\n readonly mimeType: string\n readonly filename?: string\n}\n\n/**\n * How the agent bridge splits an action output that carries file bytes: `schema` is the\n * model-facing output (the action output without the bytes, declared as the tool output) and\n * `split` returns that value plus the files. `connector.invoke` is unchanged and still returns the\n * full output to hosts.\n */\nexport type ConnectorActionFileOutput<Output> = {\n readonly schema: ActionOutputSchema\n readonly split: (output: Output) => {\n readonly value: unknown\n readonly files: ReadonlyArray<ConnectorActionFile>\n }\n}\n\n/** `ConnectorActionFileOutput` over an unknown output: `split` is `None` when the value is not\n * the action's output. */\nexport type UnknownConnectorActionFileOutput = {\n readonly schema: ActionOutputSchema\n readonly split: (output: unknown) => Option.Option<{\n readonly value: unknown\n readonly files: ReadonlyArray<ConnectorActionFile>\n }>\n}\n\nexport type ConnectorAction<Env = never, Error = never> = {\n readonly id: string\n readonly description?: string\n readonly access?: ConnectorActionAccess\n readonly inputSchema: ActionInputSchema\n readonly outputSchema: ActionOutputSchema\n readonly fileOutput?: UnknownConnectorActionFileOutput\n readonly execute: (\n input: UnknownActionExecutionInput\n ) => Effect.Effect<ActionResult<unknown>, Error | ConnectorError, Env>\n}\n\nexport type TypedConnectorAction<\n InputSchema extends ActionInputSchema,\n Output,\n Env = never,\n Error = never\n> = ConnectorAction<Env, Error> & {\n readonly inputSchema: InputSchema\n readonly outputSchema: Schema.Schema<Output> & { readonly EncodingServices: never }\n /** Validates decoded input on the type side, without replaying wire transforms.\n * Implementations remain responsible for validating external output data. */\n readonly executeTyped: (\n input: ActionExecutionInput<InputSchema['Type']>\n ) => Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env>\n}\n\nexport type DefineActionOptions<InputSchema extends ActionInputSchema, Output, Env, Error> = {\n readonly id: string\n readonly description?: string\n readonly access?: ConnectorActionAccess\n readonly inputSchema: InputSchema\n readonly outputSchema: Schema.Schema<Output> & { readonly EncodingServices: never }\n /** Set when the output carries file bytes (ADR 0009). */\n readonly fileOutput?: ConnectorActionFileOutput<Output>\n readonly execute: (\n input: ActionExecutionInput<InputSchema['Type']>\n ) => Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env>\n}\n\nconst validationError = (actionId: string, error: Schema.SchemaError) =>\n new ConnectorError({\n cause: 'validation_failed',\n message: `Invalid input for action: ${actionId}`,\n actionId,\n underlying: error\n })\n\ntype ConnectorActionPrefixFields = {\n readonly id: string\n description?: string\n access?: ConnectorActionAccess\n fileOutput?: UnknownConnectorActionFileOutput\n}\n\nexport const defineAction = <\n InputSchema extends ActionInputSchema,\n Output,\n Env = never,\n Error = never\n>(\n options: DefineActionOptions<InputSchema, Output, Env, Error>\n): TypedConnectorAction<InputSchema, Output, Env, Error> =>\n (() => {\n const fields: ConnectorActionPrefixFields = {\n id: options.id,\n description: options.description\n }\n\n if (options.access !== undefined) {\n fields.access = options.access\n }\n\n const fileOutput = options.fileOutput\n\n if (fileOutput !== undefined) {\n const isOutput = Schema.is(Schema.toType(options.outputSchema))\n\n fields.fileOutput = {\n schema: fileOutput.schema,\n split: output => (isOutput(output) ? Option.some(fileOutput.split(output)) : Option.none())\n }\n }\n\n const run = (\n input: UnknownActionExecutionInput,\n schema: Schema.Schema<InputSchema['Type']> & { readonly DecodingServices: never }\n ): Effect.Effect<ActionResult<Output>, Error | ConnectorError, Env> =>\n Schema.decodeUnknownEffect(schema)(input.input).pipe(\n Effect.mapError(error => validationError(options.id, error)),\n Effect.flatMap(params =>\n options.execute({\n integration: input.integration,\n input: params\n })\n )\n )\n\n return {\n ...fields,\n inputSchema: options.inputSchema,\n outputSchema: options.outputSchema,\n execute: input => run(input, options.inputSchema),\n executeTyped: input => run(input, Schema.toType(options.inputSchema))\n }\n })()\n"],"mappings":";;;;AA8FA,MAAM,mBAAmB,UAAkB,UACzC,IAAI,eAAe;CACjB,OAAO;CACP,SAAS,6BAA6B;CACtC;CACA,YAAY;AACd,CAAC;AASH,MAAa,gBAMX,mBAEO;CACL,MAAM,SAAsC;EAC1C,IAAI,QAAQ;EACZ,aAAa,QAAQ;CACvB;CAEA,IAAI,QAAQ,WAAW,KAAA,GACrB,OAAO,SAAS,QAAQ;CAG1B,MAAM,aAAa,QAAQ;CAE3B,IAAI,eAAe,KAAA,GAAW;EAC5B,MAAM,WAAW,OAAO,GAAG,OAAO,OAAO,QAAQ,YAAY,CAAC;EAE9D,OAAO,aAAa;GAClB,QAAQ,WAAW;GACnB,QAAO,WAAW,SAAS,MAAM,IAAI,OAAO,KAAK,WAAW,MAAM,MAAM,CAAC,IAAI,OAAO,KAAK;EAC3F;CACF;CAEA,MAAM,OACJ,OACA,WAEA,OAAO,oBAAoB,MAAM,EAAE,MAAM,KAAK,EAAE,KAC9C,OAAO,UAAS,UAAS,gBAAgB,QAAQ,IAAI,KAAK,CAAC,GAC3D,OAAO,SAAQ,WACb,QAAQ,QAAQ;EACd,aAAa,MAAM;EACnB,OAAO;CACT,CAAC,CACH,CACF;CAEF,OAAO;EACL,GAAG;EACH,aAAa,QAAQ;EACrB,cAAc,QAAQ;EACtB,UAAS,UAAS,IAAI,OAAO,QAAQ,WAAW;EAChD,eAAc,UAAS,IAAI,OAAO,OAAO,OAAO,QAAQ,WAAW,CAAC;CACtE;AACF,GAAG"}
|
package/dist/agent.d.mts
CHANGED
|
@@ -38,7 +38,9 @@ type MakeConnectorToolModuleOptions<Context, Env> = {
|
|
|
38
38
|
* declared `ToolDef.outputSchema` (a `Chunk` becomes an array, a `DateTime` an ISO string). A value
|
|
39
39
|
* that does not encode fails the call with an `execution` `ToolError`. Provider failures become
|
|
40
40
|
* error results whose `structuredContent` is the JSON encoding of the `ProviderFailure` (a
|
|
41
|
-
* non-JSON `underlying` is dropped).
|
|
41
|
+
* non-JSON `underlying` is dropped). Actions with `fileOutput` (ADR 0009) declare its byte-free
|
|
42
|
+
* schema as the tool output and return their bytes as `FilePart`s after the text, which tool
|
|
43
|
+
* resolution captures into `fileId`s.
|
|
42
44
|
*/
|
|
43
45
|
declare const makeConnectorToolRegistration: <Context, Env = never, Error = never>(connector: Connector<Env, Error>, actionId: string, options: MakeConnectorToolModuleOptions<Context, Env>) => ToolRegistration<Context>;
|
|
44
46
|
/** All actions of a connector as one tool module (`id` defaults to the connector id,
|
package/dist/agent.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.mts","names":[],"sources":["../src/agent.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent.d.mts","names":[],"sources":["../src/agent.ts"],"mappings":";;;;;;;;;KAuBY,4BAAA,YACR,oBAAA,KACE,OAAA,EAAS,OAAA,KAAY,MAAA,CAAO,MAAA,CAAO,oBAAA,EAAsB,SAAA;AAAA,KAEnD,2BAAA,GAA8B,UAAA,KAAe,QAAA,aAAqB,UAAU;;KAG5E,uBAAA,GAA0B,IAAI,CAAC,eAAA;;;;;;KAO/B,6BAAA,GACR,YAAA,KACE,QAAA,UAAkB,MAAA,EAAQ,uBAAA,iBAAwC,YAAA;AAAA,KAE5D,8BAAA;EAAA,SACD,WAAA,EAAa,4BAAA,CAA6B,OAAA;EAAA,SAC1C,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,GAAA;EAAA,SACnB,QAAA;EAnBL;;;EAAA,SAuBK,WAAA;EAAA,SACA,UAAA;EAAA,SACA,MAAA,GAAS,2BAAA;EAzBoD;AAExE;;EAFwE,SA6B7D,QAAA,GAAW,6BAAA;AAAA;;;;;AA3BkE;AAGxF;;;;AAA0D;cA4G7C,6BAAA,wCACX,SAAA,EAAW,SAAA,CAAU,GAAA,EAAK,KAAA,GAC1B,QAAA,UACA,OAAA,EAAS,8BAAA,CAA+B,OAAA,EAAS,GAAA,MAChD,gBAAA,CAAiB,OAAA;;;cA6HP,uBAAA,wCACX,SAAA,EAAW,SAAA,CAAU,GAAA,EAAK,KAAA,GAC1B,OAAA,EAAS,8BAAA,CAA+B,OAAA,EAAS,GAAA,MAChD,UAAA,CAAW,OAAA"}
|
package/dist/agent.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ProviderFailure } from "./result.mjs";
|
|
2
|
-
import { Effect, Match, Predicate } from "effect";
|
|
2
|
+
import { Effect, Match, Option, Predicate } from "effect";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import { ToolError } from "@yolk-sdk/agent/loop";
|
|
5
5
|
import { makeTool, withToolArgumentsErrorHint } from "@yolk-sdk/agent/tools";
|
|
6
|
-
import { ToolResult } from "@yolk-sdk/agent/protocol";
|
|
6
|
+
import { FilePart, TextPart, ToolResult, inlineBase64AttachmentSource } from "@yolk-sdk/agent/protocol";
|
|
7
7
|
//#region src/agent.ts
|
|
8
8
|
const resolveIntegration = (resolver, context) => {
|
|
9
9
|
if (Predicate.isFunction(resolver)) return resolver(context);
|
|
@@ -39,23 +39,50 @@ const toolName = (prefix, actionId) => prefix === void 0 ? actionId : `${prefix}
|
|
|
39
39
|
* declared `ToolDef.outputSchema` (a `Chunk` becomes an array, a `DateTime` an ISO string). A value
|
|
40
40
|
* that does not encode fails the call with an `execution` `ToolError`. Provider failures become
|
|
41
41
|
* error results whose `structuredContent` is the JSON encoding of the `ProviderFailure` (a
|
|
42
|
-
* non-JSON `underlying` is dropped).
|
|
42
|
+
* non-JSON `underlying` is dropped). Actions with `fileOutput` (ADR 0009) declare its byte-free
|
|
43
|
+
* schema as the tool output and return their bytes as `FilePart`s after the text, which tool
|
|
44
|
+
* resolution captures into `fileId`s.
|
|
43
45
|
*/
|
|
44
46
|
const makeConnectorToolRegistration = (connector, actionId, options) => {
|
|
45
47
|
const action = connector.actions.find((item) => item.id === actionId);
|
|
46
48
|
const name = toolName(options.namePrefix, actionId);
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
+
const fileOutput = action?.fileOutput;
|
|
50
|
+
const declaredOutput = fileOutput?.schema ?? action?.outputSchema;
|
|
51
|
+
const encode = declaredOutput === void 0 ? void 0 : Schema.encodeUnknownEffect(Schema.toCodecJson(declaredOutput));
|
|
52
|
+
const outputMismatch = () => new ToolError({
|
|
49
53
|
tool: name,
|
|
50
54
|
message: `${name} returned a result that does not match its output schema.`,
|
|
51
55
|
cause: "execution"
|
|
52
|
-
})
|
|
56
|
+
});
|
|
57
|
+
const encodeOutput = (value) => encode === void 0 ? Effect.succeed(value) : encode(value).pipe(Effect.mapError(outputMismatch));
|
|
58
|
+
const successResult = (callId, output) => {
|
|
59
|
+
if (fileOutput === void 0) return encodeOutput(output).pipe(Effect.map((value) => ToolResult.make({
|
|
60
|
+
toolCallId: callId,
|
|
61
|
+
content: successContent(value),
|
|
62
|
+
structuredContent: value
|
|
63
|
+
})));
|
|
64
|
+
return Option.match(fileOutput.split(output), {
|
|
65
|
+
onNone: () => Effect.fail(outputMismatch()),
|
|
66
|
+
onSome: (split) => encodeOutput(split.value).pipe(Effect.map((value) => ToolResult.make({
|
|
67
|
+
toolCallId: callId,
|
|
68
|
+
content: [TextPart.make({ text: successContent(value) }), ...split.files.map((file) => file.filename === void 0 ? FilePart.make({
|
|
69
|
+
source: inlineBase64AttachmentSource(file.base64),
|
|
70
|
+
mimeType: file.mimeType
|
|
71
|
+
}) : FilePart.make({
|
|
72
|
+
source: inlineBase64AttachmentSource(file.base64),
|
|
73
|
+
mimeType: file.mimeType,
|
|
74
|
+
filename: file.filename
|
|
75
|
+
}))],
|
|
76
|
+
structuredContent: value
|
|
77
|
+
})))
|
|
78
|
+
});
|
|
79
|
+
};
|
|
53
80
|
return makeTool({
|
|
54
81
|
...resolveExposure(options.exposure, actionId, action),
|
|
55
82
|
name,
|
|
56
83
|
description: action?.description ?? `Invoke connector action ${actionId}.`,
|
|
57
84
|
parameters: action?.inputSchema ?? Schema.Unknown,
|
|
58
|
-
output:
|
|
85
|
+
output: declaredOutput,
|
|
59
86
|
access: resolveAccess(options.access, actionId, action?.access),
|
|
60
87
|
invalidParamsMessage: (error) => withToolArgumentsErrorHint(`Invalid ${name} arguments: ${error instanceof Error ? error.message : String(error)}`, error),
|
|
61
88
|
execute: ({ call, context, params }) => resolveIntegration(options.integration, context).pipe(Effect.flatMap((integration) => connector.invoke({
|
|
@@ -66,11 +93,7 @@ const makeConnectorToolRegistration = (connector, actionId, options) => {
|
|
|
66
93
|
tool: name,
|
|
67
94
|
message: error instanceof Error ? error.message : String(error),
|
|
68
95
|
cause: "execution"
|
|
69
|
-
})), Effect.flatMap((result) => Match.value(result).pipe(Match.tag("Success", (current) =>
|
|
70
|
-
toolCallId: call.id,
|
|
71
|
-
content: successContent(value),
|
|
72
|
-
structuredContent: value
|
|
73
|
-
})))), Match.tag("Failure", (current) => failureStructuredContent(current.error).pipe(Effect.map((structuredContent) => ToolResult.make({
|
|
96
|
+
})), Effect.flatMap((result) => Match.value(result).pipe(Match.tag("Success", (current) => successResult(call.id, current.value)), Match.tag("Failure", (current) => failureStructuredContent(current.error).pipe(Effect.map((structuredContent) => ToolResult.make({
|
|
74
97
|
toolCallId: call.id,
|
|
75
98
|
content: failureContent(current.error),
|
|
76
99
|
isError: true,
|
package/dist/agent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { Effect, Match, Predicate } from 'effect'\nimport type { Layer } from 'effect'\nimport * as Schema from 'effect/Schema'\nimport { ToolError } from '@yolk-sdk/agent/loop'\nimport {\n makeTool,\n withToolArgumentsErrorHint,\n type ToolAccess,\n type ToolModule,\n type ToolRegistration\n} from '@yolk-sdk/agent/tools'\nimport { ToolResult, type ToolExposure } from '@yolk-sdk/agent/protocol'\nimport type { ConnectorAction, ConnectorActionAccess } from './action.ts'\nimport type { Connector } from './connector.ts'\nimport type { ConnectorIntegration } from './integration.ts'\nimport { ProviderFailure } from './result.ts'\n\nexport type ConnectorIntegrationResolver<Context> =\n | ConnectorIntegration\n | ((context: Context) => Effect.Effect<ConnectorIntegration, ToolError>)\n\nexport type ConnectorToolAccessResolver = ToolAccess | ((actionId: string) => ToolAccess)\n\n/** The declared metadata of a connector action, as exposure resolvers see it. */\nexport type ConnectorToolActionInfo = Pick<ConnectorAction, 'id' | 'description' | 'access'>\n\n/** Tool exposure (`callableBy`/`discovery`/`loading`) for connector tools: one value for every\n * action, or per action (`action`\n * is `undefined` when the connector does not declare `actionId`). Omitted: the agent defaults\n * (`callableBy: 'all'`).\n */\nexport type ConnectorToolExposureResolver =\n | ToolExposure\n | ((actionId: string, action: ConnectorToolActionInfo | undefined) => ToolExposure)\n\nexport type MakeConnectorToolModuleOptions<Context, Env> = {\n readonly integration: ConnectorIntegrationResolver<Context>\n readonly layer: Layer.Layer<Env>\n readonly moduleId?: string\n /** `ToolModule.description` (shown by code mode under the namespace and indexed for tool\n * search). Default: the connector's `description`.\n */\n readonly description?: string\n readonly namePrefix?: string\n readonly access?: ConnectorToolAccessResolver\n /** Applied through `makeTool`'s `callableBy`/`discovery`/`loading`; `resolveTools` still rejects\n * invalid combinations (for example `discovery` without `callableBy: 'codemode'`).\n */\n readonly exposure?: ConnectorToolExposureResolver\n}\n\nconst resolveIntegration = <Context>(\n resolver: ConnectorIntegrationResolver<Context>,\n context: Context\n) => {\n if (Predicate.isFunction(resolver)) {\n return resolver(context)\n }\n\n return Effect.succeed(resolver)\n}\n\nconst resolveAccess = (\n resolver: ConnectorToolAccessResolver | undefined,\n actionId: string,\n actionAccess: ConnectorActionAccess | undefined\n): ToolAccess => {\n if (Predicate.isFunction(resolver)) {\n return resolver(actionId)\n }\n\n return resolver ?? actionAccess ?? 'read'\n}\n\nconst resolveExposure = (\n resolver: ConnectorToolExposureResolver | undefined,\n actionId: string,\n action: ConnectorToolActionInfo | undefined\n): ToolExposure => (Predicate.isFunction(resolver) ? resolver(actionId, action) : (resolver ?? {}))\n\nconst failureContent = (failure: ProviderFailure) => `${failure.code}: ${failure.message}`\n\nconst encodeProviderFailure = Schema.encodeUnknownEffect(Schema.toCodecJson(ProviderFailure))\n\ntype ProviderFailureSummary = {\n readonly code: string\n readonly message: string\n status?: number\n retryAfterMs?: number\n}\n\nconst providerFailureSummary = (failure: ProviderFailure) => {\n const summary: ProviderFailureSummary = { code: failure.code, message: failure.message }\n\n if (failure.status !== undefined) summary.status = failure.status\n\n if (failure.retryAfterMs !== undefined) summary.retryAfterMs = failure.retryAfterMs\n\n return summary\n}\n\n/** The JSON encoding of a provider failure; a non-JSON `underlying` (for example a wrapped\n * error) is dropped. */\nconst failureStructuredContent = (failure: ProviderFailure) =>\n encodeProviderFailure(failure).pipe(\n Effect.catch(() =>\n encodeProviderFailure(ProviderFailure.make(providerFailureSummary(failure)))\n ),\n Effect.orElseSucceed(() => providerFailureSummary(failure))\n )\n\nconst successContent = (value: unknown) => {\n if (Predicate.isString(value)) {\n return value\n }\n\n return JSON.stringify(value)\n}\n\nconst toolName = (prefix: string | undefined, actionId: string) =>\n prefix === undefined ? actionId : `${prefix}.${actionId}`\n\n/**\n * One connector action as an agent tool. Success values are returned as the JSON encoding of the\n * action `outputSchema` (`Schema.toCodecJson`): `structuredContent` and the text content match the\n * declared `ToolDef.outputSchema` (a `Chunk` becomes an array, a `DateTime` an ISO string). A value\n * that does not encode fails the call with an `execution` `ToolError`. Provider failures become\n * error results whose `structuredContent` is the JSON encoding of the `ProviderFailure` (a\n * non-JSON `underlying` is dropped).\n */\nexport const makeConnectorToolRegistration = <Context, Env = never, Error = never>(\n connector: Connector<Env, Error>,\n actionId: string,\n options: MakeConnectorToolModuleOptions<Context, Env>\n): ToolRegistration<Context> => {\n const action = connector.actions.find(item => item.id === actionId)\n const name = toolName(options.namePrefix, actionId)\n\n const encode =\n action === undefined\n ? undefined\n : Schema.encodeUnknownEffect(Schema.toCodecJson(action.outputSchema))\n\n // Without a declared action there is no output schema to encode to: keep the value as is.\n const encodeOutput = (value: unknown): Effect.Effect<unknown, ToolError> =>\n encode === undefined\n ? Effect.succeed(value)\n : encode(value).pipe(\n Effect.mapError(\n () =>\n new ToolError({\n tool: name,\n message: `${name} returned a result that does not match its output schema.`,\n cause: 'execution'\n })\n )\n )\n\n return makeTool({\n ...resolveExposure(options.exposure, actionId, action),\n name,\n description: action?.description ?? `Invoke connector action ${actionId}.`,\n parameters: action?.inputSchema ?? Schema.Unknown,\n output: action?.outputSchema,\n access: resolveAccess(options.access, actionId, action?.access),\n invalidParamsMessage: error =>\n withToolArgumentsErrorHint(\n `Invalid ${name} arguments: ${error instanceof Error ? error.message : String(error)}`,\n error\n ),\n execute: ({ call, context, params }) =>\n resolveIntegration(options.integration, context).pipe(\n Effect.flatMap(integration =>\n connector\n .invoke({\n integration,\n action: actionId,\n input: params\n })\n .pipe(Effect.provide(options.layer))\n ),\n Effect.mapError(\n error =>\n new ToolError({\n tool: name,\n message: error instanceof Error ? error.message : String(error),\n cause: 'execution'\n })\n ),\n Effect.flatMap(result =>\n Match.value(result).pipe(\n Match.tag('Success', current =>\n encodeOutput(current.value).pipe(\n Effect.map(value =>\n ToolResult.make({\n toolCallId: call.id,\n content: successContent(value),\n structuredContent: value\n })\n )\n )\n ),\n Match.tag('Failure', current =>\n failureStructuredContent(current.error).pipe(\n Effect.map(structuredContent =>\n ToolResult.make({\n toolCallId: call.id,\n content: failureContent(current.error),\n isError: true,\n structuredContent\n })\n )\n )\n ),\n Match.exhaustive\n )\n )\n )\n })\n}\n\n/** All actions of a connector as one tool module (`id` defaults to the connector id,\n * `description` to the connector description). */\nexport const makeConnectorToolModule = <Context, Env = never, Error = never>(\n connector: Connector<Env, Error>,\n options: MakeConnectorToolModuleOptions<Context, Env>\n): ToolModule<Context> => {\n const description = options.description ?? connector.description\n\n const tools = connector.actions.map(action =>\n makeConnectorToolRegistration(connector, action.id, options)\n )\n\n const id = options.moduleId ?? connector.id\n\n return description === undefined ? { id, tools } : { id, description, tools }\n}\n"],"mappings":";;;;;;;AAmDA,MAAM,sBACJ,UACA,YACG;CACH,IAAI,UAAU,WAAW,QAAQ,GAC/B,OAAO,SAAS,OAAO;CAGzB,OAAO,OAAO,QAAQ,QAAQ;AAChC;AAEA,MAAM,iBACJ,UACA,UACA,iBACe;CACf,IAAI,UAAU,WAAW,QAAQ,GAC/B,OAAO,SAAS,QAAQ;CAG1B,OAAO,YAAY,gBAAgB;AACrC;AAEA,MAAM,mBACJ,UACA,UACA,WACkB,UAAU,WAAW,QAAQ,IAAI,SAAS,UAAU,MAAM,IAAK,YAAY,CAAC;AAEhG,MAAM,kBAAkB,YAA6B,GAAG,QAAQ,KAAK,IAAI,QAAQ;AAEjF,MAAM,wBAAwB,OAAO,oBAAoB,OAAO,YAAY,eAAe,CAAC;AAS5F,MAAM,0BAA0B,YAA6B;CAC3D,MAAM,UAAkC;EAAE,MAAM,QAAQ;EAAM,SAAS,QAAQ;CAAQ;CAEvF,IAAI,QAAQ,WAAW,KAAA,GAAW,QAAQ,SAAS,QAAQ;CAE3D,IAA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AC/C,OAAO,SAAQ,gBACb,UACG,OAAO;GACN;GACA,QAAQ;GACR,OAAO;EACT,CAAC,EACA,KAAK,OAAO,QAAQ,QAAQ,KAAK,CAAC,CACvC,GACA,OAAO,UACL,UACE,IAAI,UAAU;GACZ,MAAM;GACN,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC9D,OAAO;EACT,CAAC,CACL,GACA,OAAO,SAAQ,WACb,MAAM,MAAM,MAAM,EAAE,KAClB,MAAM,IAAI,YAAW,YACnB,aAAa,QAAQ,KAAK,EAAE,KAC1B,OAAO,KAAI,UACT,WAAW,KAAK;GACd,YAAY,KAAK;GACjB,SAAS,eAAe,KAAK;GAC7B,mBAAmB;EACrB,CAAC,CACH,CACF,CACF,GACA,MAAM,IAAI,YAAW,YACnB,yBAAyB,QAAQ,KAAK,EAAE,KACtC,OAAO,KAAI,sBACT,WAAW,KAAK;GACd,YAAY,KAAK;GACjB,SAAS,eAAe,QAAQ,KAAK;GACrC,SAAS;GACT;EACF,CAAC,CACH,CACF,CACF,GACA,MAAM,UACR,CACF,CACF;CACJ,CAAC;AACH;;;AAIA,MAAa,2BACX,WACA,YACwB;CACxB,MAAM,cAAc,QAAQ,eAAe,UAAU;CAErD,MAAM,QAAQ,UAAU,QAAQ,KAAI,WAClC,8BAA8B,WAAW,OAAO,IAAI,OAAO,CAC7D;CAEA,MAAM,KAAK,QAAQ,YAAY,UAAU;CAEzC,OAAO,gBAAgB,KAAA,IAAY;EAAE;EAAI;CAAM,IAAI;EAAE;EAAI;EAAa;CAAM;AAC9E"}
|
|
1
|
+
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { Effect, Match, Option, Predicate } from 'effect'\nimport type { Layer } from 'effect'\nimport * as Schema from 'effect/Schema'\nimport { ToolError } from '@yolk-sdk/agent/loop'\nimport {\n makeTool,\n withToolArgumentsErrorHint,\n type ToolAccess,\n type ToolModule,\n type ToolRegistration\n} from '@yolk-sdk/agent/tools'\nimport {\n FilePart,\n inlineBase64AttachmentSource,\n TextPart,\n ToolResult,\n type ToolExposure\n} from '@yolk-sdk/agent/protocol'\nimport type { ConnectorAction, ConnectorActionAccess } from './action.ts'\nimport type { Connector } from './connector.ts'\nimport type { ConnectorIntegration } from './integration.ts'\nimport { ProviderFailure } from './result.ts'\n\nexport type ConnectorIntegrationResolver<Context> =\n | ConnectorIntegration\n | ((context: Context) => Effect.Effect<ConnectorIntegration, ToolError>)\n\nexport type ConnectorToolAccessResolver = ToolAccess | ((actionId: string) => ToolAccess)\n\n/** The declared metadata of a connector action, as exposure resolvers see it. */\nexport type ConnectorToolActionInfo = Pick<ConnectorAction, 'id' | 'description' | 'access'>\n\n/** Tool exposure (`callableBy`/`discovery`/`loading`) for connector tools: one value for every\n * action, or per action (`action`\n * is `undefined` when the connector does not declare `actionId`). Omitted: the agent defaults\n * (`callableBy: 'all'`).\n */\nexport type ConnectorToolExposureResolver =\n | ToolExposure\n | ((actionId: string, action: ConnectorToolActionInfo | undefined) => ToolExposure)\n\nexport type MakeConnectorToolModuleOptions<Context, Env> = {\n readonly integration: ConnectorIntegrationResolver<Context>\n readonly layer: Layer.Layer<Env>\n readonly moduleId?: string\n /** `ToolModule.description` (shown by code mode under the namespace and indexed for tool\n * search). Default: the connector's `description`.\n */\n readonly description?: string\n readonly namePrefix?: string\n readonly access?: ConnectorToolAccessResolver\n /** Applied through `makeTool`'s `callableBy`/`discovery`/`loading`; `resolveTools` still rejects\n * invalid combinations (for example `discovery` without `callableBy: 'codemode'`).\n */\n readonly exposure?: ConnectorToolExposureResolver\n}\n\nconst resolveIntegration = <Context>(\n resolver: ConnectorIntegrationResolver<Context>,\n context: Context\n) => {\n if (Predicate.isFunction(resolver)) {\n return resolver(context)\n }\n\n return Effect.succeed(resolver)\n}\n\nconst resolveAccess = (\n resolver: ConnectorToolAccessResolver | undefined,\n actionId: string,\n actionAccess: ConnectorActionAccess | undefined\n): ToolAccess => {\n if (Predicate.isFunction(resolver)) {\n return resolver(actionId)\n }\n\n return resolver ?? actionAccess ?? 'read'\n}\n\nconst resolveExposure = (\n resolver: ConnectorToolExposureResolver | undefined,\n actionId: string,\n action: ConnectorToolActionInfo | undefined\n): ToolExposure => (Predicate.isFunction(resolver) ? resolver(actionId, action) : (resolver ?? {}))\n\nconst failureContent = (failure: ProviderFailure) => `${failure.code}: ${failure.message}`\n\nconst encodeProviderFailure = Schema.encodeUnknownEffect(Schema.toCodecJson(ProviderFailure))\n\ntype ProviderFailureSummary = {\n readonly code: string\n readonly message: string\n status?: number\n retryAfterMs?: number\n}\n\nconst providerFailureSummary = (failure: ProviderFailure) => {\n const summary: ProviderFailureSummary = { code: failure.code, message: failure.message }\n\n if (failure.status !== undefined) summary.status = failure.status\n\n if (failure.retryAfterMs !== undefined) summary.retryAfterMs = failure.retryAfterMs\n\n return summary\n}\n\n/** The JSON encoding of a provider failure; a non-JSON `underlying` (for example a wrapped\n * error) is dropped. */\nconst failureStructuredContent = (failure: ProviderFailure) =>\n encodeProviderFailure(failure).pipe(\n Effect.catch(() =>\n encodeProviderFailure(ProviderFailure.make(providerFailureSummary(failure)))\n ),\n Effect.orElseSucceed(() => providerFailureSummary(failure))\n )\n\nconst successContent = (value: unknown) => {\n if (Predicate.isString(value)) {\n return value\n }\n\n return JSON.stringify(value)\n}\n\nconst toolName = (prefix: string | undefined, actionId: string) =>\n prefix === undefined ? actionId : `${prefix}.${actionId}`\n\n/**\n * One connector action as an agent tool. Success values are returned as the JSON encoding of the\n * action `outputSchema` (`Schema.toCodecJson`): `structuredContent` and the text content match the\n * declared `ToolDef.outputSchema` (a `Chunk` becomes an array, a `DateTime` an ISO string). A value\n * that does not encode fails the call with an `execution` `ToolError`. Provider failures become\n * error results whose `structuredContent` is the JSON encoding of the `ProviderFailure` (a\n * non-JSON `underlying` is dropped). Actions with `fileOutput` (ADR 0009) declare its byte-free\n * schema as the tool output and return their bytes as `FilePart`s after the text, which tool\n * resolution captures into `fileId`s.\n */\nexport const makeConnectorToolRegistration = <Context, Env = never, Error = never>(\n connector: Connector<Env, Error>,\n actionId: string,\n options: MakeConnectorToolModuleOptions<Context, Env>\n): ToolRegistration<Context> => {\n const action = connector.actions.find(item => item.id === actionId)\n const name = toolName(options.namePrefix, actionId)\n\n const fileOutput = action?.fileOutput\n\n // Actions whose output carries file bytes declare their byte-free output (ADR 0009).\n const declaredOutput = fileOutput?.schema ?? action?.outputSchema\n\n const encode =\n declaredOutput === undefined\n ? undefined\n : Schema.encodeUnknownEffect(Schema.toCodecJson(declaredOutput))\n\n // Without a declared action there is no output schema to encode to: keep the value as is.\n const outputMismatch = () =>\n new ToolError({\n tool: name,\n message: `${name} returned a result that does not match its output schema.`,\n cause: 'execution'\n })\n\n const encodeOutput = (value: unknown): Effect.Effect<unknown, ToolError> =>\n encode === undefined\n ? Effect.succeed(value)\n : encode(value).pipe(Effect.mapError(outputMismatch))\n\n // The success result: the encoded output as text and `structuredContent`, then any file parts.\n const successResult = (callId: string, output: unknown) => {\n if (fileOutput === undefined) {\n return encodeOutput(output).pipe(\n Effect.map(value =>\n ToolResult.make({\n toolCallId: callId,\n content: successContent(value),\n structuredContent: value\n })\n )\n )\n }\n\n return Option.match(fileOutput.split(output), {\n onNone: () => Effect.fail(outputMismatch()),\n onSome: split =>\n encodeOutput(split.value).pipe(\n Effect.map(value =>\n ToolResult.make({\n toolCallId: callId,\n content: [\n TextPart.make({ text: successContent(value) }),\n ...split.files.map(file =>\n file.filename === undefined\n ? FilePart.make({\n source: inlineBase64AttachmentSource(file.base64),\n mimeType: file.mimeType\n })\n : FilePart.make({\n source: inlineBase64AttachmentSource(file.base64),\n mimeType: file.mimeType,\n filename: file.filename\n })\n )\n ],\n structuredContent: value\n })\n )\n )\n })\n }\n\n return makeTool({\n ...resolveExposure(options.exposure, actionId, action),\n name,\n description: action?.description ?? `Invoke connector action ${actionId}.`,\n parameters: action?.inputSchema ?? Schema.Unknown,\n output: declaredOutput,\n access: resolveAccess(options.access, actionId, action?.access),\n invalidParamsMessage: error =>\n withToolArgumentsErrorHint(\n `Invalid ${name} arguments: ${error instanceof Error ? error.message : String(error)}`,\n error\n ),\n execute: ({ call, context, params }) =>\n resolveIntegration(options.integration, context).pipe(\n Effect.flatMap(integration =>\n connector\n .invoke({\n integration,\n action: actionId,\n input: params\n })\n .pipe(Effect.provide(options.layer))\n ),\n Effect.mapError(\n error =>\n new ToolError({\n tool: name,\n message: error instanceof Error ? error.message : String(error),\n cause: 'execution'\n })\n ),\n Effect.flatMap(result =>\n Match.value(result).pipe(\n Match.tag('Success', current => successResult(call.id, current.value)),\n Match.tag('Failure', current =>\n failureStructuredContent(current.error).pipe(\n Effect.map(structuredContent =>\n ToolResult.make({\n toolCallId: call.id,\n content: failureContent(current.error),\n isError: true,\n structuredContent\n })\n )\n )\n ),\n Match.exhaustive\n )\n )\n )\n })\n}\n\n/** All actions of a connector as one tool module (`id` defaults to the connector id,\n * `description` to the connector description). */\nexport const makeConnectorToolModule = <Context, Env = never, Error = never>(\n connector: Connector<Env, Error>,\n options: MakeConnectorToolModuleOptions<Context, Env>\n): ToolModule<Context> => {\n const description = options.description ?? connector.description\n\n const tools = connector.actions.map(action =>\n makeConnectorToolRegistration(connector, action.id, options)\n )\n\n const id = options.moduleId ?? connector.id\n\n return description === undefined ? { id, tools } : { id, description, tools }\n}\n"],"mappings":";;;;;;;AAyDA,MAAM,sBACJ,UACA,YACG;CACH,IAAI,UAAU,WAAW,QAAQ,GAC/B,OAAO,SAAS,OAAO;CAGzB,OAAO,OAAO,QAAQ,QAAQ;AAChC;AAEA,MAAM,iBACJ,UACA,UACA,iBACe;CACf,IAAI,UAAU,WAAW,QAAQ,GAC/B,OAAO,SAAS,QAAQ;CAG1B,OAAO,YAAY,gBAAgB;AACrC;AAEA,MAAM,mBACJ,UACA,UACA,WACkB,UAAU,WAAW,QAAQ,IAAI,SAAS,UAAU,MAAM,IAAK,YAAY,CAAC;AAEhG,MAAM,kBAAkB,YAA6B,GAAG,QAAQ,KAAK,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AiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC9D,OAAO;EACT,CAAC,CACL,GACA,OAAO,SAAQ,WACb,MAAM,MAAM,MAAM,EAAE,KAClB,MAAM,IAAI,YAAW,YAAW,cAAc,KAAK,IAAI,QAAQ,KAAK,CAAC,GACrE,MAAM,IAAI,YAAW,YACnB,yBAAyB,QAAQ,KAAK,EAAE,KACtC,OAAO,KAAI,sBACT,WAAW,KAAK;GACd,YAAY,KAAK;GACjB,SAAS,eAAe,QAAQ,KAAK;GACrC,SAAS;GACT;EACF,CAAC,CACH,CACF,CACF,GACA,MAAM,UACR,CACF,CACF;CACJ,CAAC;AACH;;;AAIA,MAAa,2BACX,WACA,YACwB;CACxB,MAAM,cAAc,QAAQ,eAAe,UAAU;CAErD,MAAM,QAAQ,UAAU,QAAQ,KAAI,WAClC,8BAA8B,WAAW,OAAO,IAAI,OAAO,CAC7D;CAEA,MAAM,KAAK,QAAQ,YAAY,UAAU;CAEzC,OAAO,gBAAgB,KAAA,IAAY;EAAE;EAAI;CAAM,IAAI;EAAE;EAAI;EAAa;CAAM;AAC9E"}
|
package/dist/email/index.d.mts
CHANGED
|
@@ -164,6 +164,11 @@ declare const EmailGetAttachmentOutput_base: Schema.Class<EmailGetAttachmentOutp
|
|
|
164
164
|
readonly attachment: typeof EmailAttachmentContent;
|
|
165
165
|
}>, {}>;
|
|
166
166
|
declare class EmailGetAttachmentOutput extends EmailGetAttachmentOutput_base {}
|
|
167
|
+
declare const EmailGetAttachmentFileOutput_base: Schema.Class<EmailGetAttachmentFileOutput, Schema.Struct<{
|
|
168
|
+
readonly attachment: typeof EmailAttachmentMetadata;
|
|
169
|
+
}>, {}>;
|
|
170
|
+
/** The model-facing `email.get_attachment` output (ADR 0009): the bytes travel as a file. */
|
|
171
|
+
declare class EmailGetAttachmentFileOutput extends EmailGetAttachmentFileOutput_base {}
|
|
167
172
|
declare const EmailSetReadInput_base: Schema.Class<EmailSetReadInput, Schema.Struct<{
|
|
168
173
|
readonly messageId: Schema.Trimmed;
|
|
169
174
|
readonly folder: Schema.optional<Schema.brand<Schema.Trimmed, "EmailFolderName">>;
|
|
@@ -738,5 +743,5 @@ declare const downloadEmailAttachment: (integration: ConnectorIntegration, input
|
|
|
738
743
|
contentType?: string | undefined;
|
|
739
744
|
}, ConnectorFileTransferError, CredentialResolver | EmailClient>;
|
|
740
745
|
//#endregion
|
|
741
|
-
export { EmailAddress, EmailAttachmentBase64, EmailAttachmentBytesResult, EmailAttachmentContent, EmailAttachmentMetadata, EmailBatchMessageIds, EmailBatchModifyLabelsInput, EmailBatchModifyLabelsRequest, EmailBatchMoveInput, EmailBatchMoveOutput, EmailBatchMoveRequest, EmailBatchMoveResultItem, EmailBatchOperationOutput, EmailBatchOperationStatus, EmailBatchResultCode, EmailBatchResultItem, EmailBatchSetFlagInput, EmailBatchSetFlagRequest, EmailBatchSetReadInput, EmailBatchSetReadRequest, EmailBatchSummary, EmailBatchTrashInput, EmailBatchTrashRequest, EmailBatchUntrashInput, EmailBatchUntrashRequest, EmailBody, EmailClient, EmailClientApi, EmailComposeMessage, EmailConnector, EmailCreateDraftInput, EmailCreateDraftOutput, EmailCreateDraftRequest, EmailDeletePermanentlyInput, EmailDeletePermanentlyRequest, EmailDraftId, EmailFolderName, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetAttachmentRequest, EmailGetMessageInput, EmailGetMessageOutput, EmailGetMessageRequest, EmailImapConnection, EmailImapKeyword, EmailIncomingConnection, EmailIncomingCredentialSlot, EmailIncomingProtocol, EmailListMessagesInput, EmailListMessagesOutput, EmailListMessagesRequest, EmailMessage, EmailMessageHeader, EmailMessageSummary, EmailModifyLabelsInput, EmailModifyLabelsOutput, EmailModifyLabelsRequest, EmailMoveInput, EmailMoveMessageOutput, EmailMoveRequest, EmailSecurity, EmailSendMessageInput, EmailSendMessageOutput, EmailSendMessageRequest, EmailSentCopyOutput, EmailSentCopyRequest, EmailSentCopyStatus, EmailSetFlagInput, EmailSetFlagOutput, EmailSetFlagRequest, EmailSetReadInput, EmailSetReadOutput, EmailSetReadRequest, EmailSmtpConnection, EmailSmtpCredentialSlot, EmailSmtpProtocol, EmailTrashInput, EmailTrashRequest, EmailUntrashInput, EmailUntrashRequest, downloadEmailAttachment, emailActions, emailBatchModifyLabelsAction, emailBatchMoveAction, emailBatchSetFlagAction, emailBatchSetReadAction, emailBatchTrashAction, emailBatchUntrashAction, emailConnectorId, emailCreateDraftAction, emailDeletePermanentlyAction, emailGetAttachmentAction, emailGetMessageAction, emailIncomingCredentialSlotId, emailIncomingHostConfigKey, emailIncomingPortConfigKey, emailIncomingProtocolConfigKey, emailIncomingSecurityConfigKey, emailListMessagesAction, emailModifyLabelsAction, emailMoveAction, emailSendMessageAction, emailSetFlagAction, emailSetReadAction, emailSmtpCredentialSlotId, emailSmtpHostConfigKey, emailSmtpPortConfigKey, emailSmtpProtocolConfigKey, emailSmtpSecurityConfigKey, emailTrashAction, emailUntrashAction };
|
|
746
|
+
export { EmailAddress, EmailAttachmentBase64, EmailAttachmentBytesResult, EmailAttachmentContent, EmailAttachmentMetadata, EmailBatchMessageIds, EmailBatchModifyLabelsInput, EmailBatchModifyLabelsRequest, EmailBatchMoveInput, EmailBatchMoveOutput, EmailBatchMoveRequest, EmailBatchMoveResultItem, EmailBatchOperationOutput, EmailBatchOperationStatus, EmailBatchResultCode, EmailBatchResultItem, EmailBatchSetFlagInput, EmailBatchSetFlagRequest, EmailBatchSetReadInput, EmailBatchSetReadRequest, EmailBatchSummary, EmailBatchTrashInput, EmailBatchTrashRequest, EmailBatchUntrashInput, EmailBatchUntrashRequest, EmailBody, EmailClient, EmailClientApi, EmailComposeMessage, EmailConnector, EmailCreateDraftInput, EmailCreateDraftOutput, EmailCreateDraftRequest, EmailDeletePermanentlyInput, EmailDeletePermanentlyRequest, EmailDraftId, EmailFolderName, EmailGetAttachmentFileOutput, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetAttachmentRequest, EmailGetMessageInput, EmailGetMessageOutput, EmailGetMessageRequest, EmailImapConnection, EmailImapKeyword, EmailIncomingConnection, EmailIncomingCredentialSlot, EmailIncomingProtocol, EmailListMessagesInput, EmailListMessagesOutput, EmailListMessagesRequest, EmailMessage, EmailMessageHeader, EmailMessageSummary, EmailModifyLabelsInput, EmailModifyLabelsOutput, EmailModifyLabelsRequest, EmailMoveInput, EmailMoveMessageOutput, EmailMoveRequest, EmailSecurity, EmailSendMessageInput, EmailSendMessageOutput, EmailSendMessageRequest, EmailSentCopyOutput, EmailSentCopyRequest, EmailSentCopyStatus, EmailSetFlagInput, EmailSetFlagOutput, EmailSetFlagRequest, EmailSetReadInput, EmailSetReadOutput, EmailSetReadRequest, EmailSmtpConnection, EmailSmtpCredentialSlot, EmailSmtpProtocol, EmailTrashInput, EmailTrashRequest, EmailUntrashInput, EmailUntrashRequest, downloadEmailAttachment, emailActions, emailBatchModifyLabelsAction, emailBatchMoveAction, emailBatchSetFlagAction, emailBatchSetReadAction, emailBatchTrashAction, emailBatchUntrashAction, emailConnectorId, emailCreateDraftAction, emailDeletePermanentlyAction, emailGetAttachmentAction, emailGetMessageAction, emailIncomingCredentialSlotId, emailIncomingHostConfigKey, emailIncomingPortConfigKey, emailIncomingProtocolConfigKey, emailIncomingSecurityConfigKey, emailListMessagesAction, emailModifyLabelsAction, emailMoveAction, emailSendMessageAction, emailSetFlagAction, emailSetReadAction, emailSmtpCredentialSlotId, emailSmtpHostConfigKey, emailSmtpPortConfigKey, emailSmtpProtocolConfigKey, emailSmtpSecurityConfigKey, emailTrashAction, emailUntrashAction };
|
|
742
747
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/email/index.ts"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/email/index.ts"],"mappings":";;;;;;;;;;;;cA8Ca,gBAAA;AAAA,cAEA,6BAAA;AAAA,cAEA,yB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cAAA,IAAA,oBAAA,QAAA,iBAAA,EAAA,kBAAA,EAAA,kBAAA,GAAA,WAAA,EAAA,cAAA,IAAA,oBAAA,QAAA,iBAAA,EAAA,kBAAA,EAAA,kBAAA,GAAA,WAAA,EAAA,cAAA,IAAA,oBAAA,QAAA,eAAA,EAAA,sBAAA,EAAA,kBAAA,GAAA,WAAA,EAAA,cAAA,IAAA,oBAAA,QAAA,iBAAA,EAAA,sBAAA,EAAA,kBAAA,GAAA,WAAA,EAAA,cAAA,yBAAA,MAAA,CAAA,QAAA,CAAA,MAAA,CAAA,kBAAA,CAAA,sBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqBZ,cAAA,EAAc,SAAA,CAAA,kBAAA,GAAA,WAAA,EAAA,cAAA;;cAOd,uBAAA,GACX,WAAA,EAAa,oBAAA,EACb,KAAA;EAAA,SAAkB,SAAA;EAAA,SAA4B,YAAA;EAAA,SAA+B,MAAA;AAAA,GAC7E,MAAA,EAAQ,2BAAA,KAA2B,MAAA,CAAA,MAAA"}
|
package/dist/email/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { requiredStringConfig } from "../config.mjs";
|
|
|
5
5
|
import { defineConnector } from "../connector.mjs";
|
|
6
6
|
import { CredentialSlot, UsernamePasswordCredential, resolveCredential } from "../credential.mjs";
|
|
7
7
|
import { EmailBatchMessageIds, EmailBatchOperationOutput, EmailBatchOperationStatus, EmailBatchResultCode, EmailBatchResultItem, EmailBatchSummary } from "../email-batch.mjs";
|
|
8
|
+
import { connectorActionFile } from "../file-output.mjs";
|
|
8
9
|
import { ConnectorFileTransferError } from "../file-transfer.mjs";
|
|
9
10
|
import { ByteLimit, SafeText, credentialFailure, decodeInput, failTransfer, fileBytes, isBytes, validateTransfer } from "../transfer-internal.mjs";
|
|
10
11
|
import { Context, Effect, Match, Predicate } from "effect";
|
|
@@ -154,6 +155,8 @@ var EmailGetAttachmentInput = class extends Schema.Class("EmailGetAttachmentInpu
|
|
|
154
155
|
folder: Schema.optionalKey(EmailFolderName)
|
|
155
156
|
}) {};
|
|
156
157
|
var EmailGetAttachmentOutput = class extends Schema.Class("EmailGetAttachmentOutput")({ attachment: EmailAttachmentContent }) {};
|
|
158
|
+
/** The model-facing `email.get_attachment` output (ADR 0009): the bytes travel as a file. */
|
|
159
|
+
var EmailGetAttachmentFileOutput = class extends Schema.Class("EmailGetAttachmentFileOutput")({ attachment: EmailAttachmentMetadata }) {};
|
|
157
160
|
const EmailNonEmptyMessageId = Schema.Trimmed.check(Schema.isNonEmpty());
|
|
158
161
|
var EmailSetReadInput = class extends Schema.Class("EmailSetReadInput")({
|
|
159
162
|
messageId: EmailNonEmptyMessageId,
|
|
@@ -642,10 +645,24 @@ const emailGetMessageAction = defineAction({
|
|
|
642
645
|
});
|
|
643
646
|
const emailGetAttachmentAction = defineAction({
|
|
644
647
|
id: "email.get_attachment",
|
|
645
|
-
description: "Get one decoded attachment from a configured IMAP or POP3 account as base64.",
|
|
648
|
+
description: "Get one decoded attachment from a configured IMAP or POP3 account. As an agent tool it returns the attachment as a file (fileId) with its metadata; invoked directly it returns base64.",
|
|
646
649
|
access: "read",
|
|
647
650
|
inputSchema: EmailGetAttachmentInput,
|
|
648
651
|
outputSchema: EmailGetAttachmentOutput,
|
|
652
|
+
fileOutput: {
|
|
653
|
+
schema: EmailGetAttachmentFileOutput,
|
|
654
|
+
split: (output) => {
|
|
655
|
+
const { contentBase64, ...metadata } = output.attachment;
|
|
656
|
+
return {
|
|
657
|
+
value: EmailGetAttachmentFileOutput.make({ attachment: EmailAttachmentMetadata.make(metadata) }),
|
|
658
|
+
files: [connectorActionFile({
|
|
659
|
+
base64: contentBase64,
|
|
660
|
+
mimeType: metadata.contentType,
|
|
661
|
+
filename: metadata.filename
|
|
662
|
+
})]
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
},
|
|
649
666
|
execute: ({ integration, input }) => Effect.gen(function* () {
|
|
650
667
|
const connection = yield* incomingConnection(integration);
|
|
651
668
|
yield* rejectPop3Folder(integration, connection, input.folder);
|
|
@@ -1149,6 +1166,6 @@ const downloadEmailAttachment = (integration, input, budget) => Effect.gen(funct
|
|
|
1149
1166
|
};
|
|
1150
1167
|
});
|
|
1151
1168
|
//#endregion
|
|
1152
|
-
export { EmailAddress, EmailAttachmentBase64, EmailAttachmentContent, EmailAttachmentMetadata, EmailBatchMessageIds, EmailBatchModifyLabelsInput, EmailBatchModifyLabelsRequest, EmailBatchMoveInput, EmailBatchMoveOutput, EmailBatchMoveRequest, EmailBatchMoveResultItem, EmailBatchOperationOutput, EmailBatchOperationStatus, EmailBatchResultCode, EmailBatchResultItem, EmailBatchSetFlagInput, EmailBatchSetFlagRequest, EmailBatchSetReadInput, EmailBatchSetReadRequest, EmailBatchSummary, EmailBatchTrashInput, EmailBatchTrashRequest, EmailBatchUntrashInput, EmailBatchUntrashRequest, EmailBody, EmailClient, EmailComposeMessage, EmailConnector, EmailCreateDraftInput, EmailCreateDraftOutput, EmailCreateDraftRequest, EmailDeletePermanentlyInput, EmailDeletePermanentlyRequest, EmailDraftId, EmailFolderName, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetAttachmentRequest, EmailGetMessageInput, EmailGetMessageOutput, EmailGetMessageRequest, EmailImapConnection, EmailImapKeyword, EmailIncomingConnection, EmailIncomingCredentialSlot, EmailIncomingProtocol, EmailListMessagesInput, EmailListMessagesOutput, EmailListMessagesRequest, EmailMessage, EmailMessageHeader, EmailMessageSummary, EmailModifyLabelsInput, EmailModifyLabelsOutput, EmailModifyLabelsRequest, EmailMoveInput, EmailMoveMessageOutput, EmailMoveRequest, EmailSecurity, EmailSendMessageInput, EmailSendMessageOutput, EmailSendMessageRequest, EmailSentCopyOutput, EmailSentCopyRequest, EmailSentCopyStatus, EmailSetFlagInput, EmailSetFlagOutput, EmailSetFlagRequest, EmailSetReadInput, EmailSetReadOutput, EmailSetReadRequest, EmailSmtpConnection, EmailSmtpCredentialSlot, EmailSmtpProtocol, EmailTrashInput, EmailTrashRequest, EmailUntrashInput, EmailUntrashRequest, downloadEmailAttachment, emailActions, emailBatchModifyLabelsAction, emailBatchMoveAction, emailBatchSetFlagAction, emailBatchSetReadAction, emailBatchTrashAction, emailBatchUntrashAction, emailConnectorId, emailCreateDraftAction, emailDeletePermanentlyAction, emailGetAttachmentAction, emailGetMessageAction, emailIncomingCredentialSlotId, emailIncomingHostConfigKey, emailIncomingPortConfigKey, emailIncomingProtocolConfigKey, emailIncomingSecurityConfigKey, emailListMessagesAction, emailModifyLabelsAction, emailMoveAction, emailSendMessageAction, emailSetFlagAction, emailSetReadAction, emailSmtpCredentialSlotId, emailSmtpHostConfigKey, emailSmtpPortConfigKey, emailSmtpProtocolConfigKey, emailSmtpSecurityConfigKey, emailTrashAction, emailUntrashAction };
|
|
1169
|
+
export { EmailAddress, EmailAttachmentBase64, EmailAttachmentContent, EmailAttachmentMetadata, EmailBatchMessageIds, EmailBatchModifyLabelsInput, EmailBatchModifyLabelsRequest, EmailBatchMoveInput, EmailBatchMoveOutput, EmailBatchMoveRequest, EmailBatchMoveResultItem, EmailBatchOperationOutput, EmailBatchOperationStatus, EmailBatchResultCode, EmailBatchResultItem, EmailBatchSetFlagInput, EmailBatchSetFlagRequest, EmailBatchSetReadInput, EmailBatchSetReadRequest, EmailBatchSummary, EmailBatchTrashInput, EmailBatchTrashRequest, EmailBatchUntrashInput, EmailBatchUntrashRequest, EmailBody, EmailClient, EmailComposeMessage, EmailConnector, EmailCreateDraftInput, EmailCreateDraftOutput, EmailCreateDraftRequest, EmailDeletePermanentlyInput, EmailDeletePermanentlyRequest, EmailDraftId, EmailFolderName, EmailGetAttachmentFileOutput, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetAttachmentRequest, EmailGetMessageInput, EmailGetMessageOutput, EmailGetMessageRequest, EmailImapConnection, EmailImapKeyword, EmailIncomingConnection, EmailIncomingCredentialSlot, EmailIncomingProtocol, EmailListMessagesInput, EmailListMessagesOutput, EmailListMessagesRequest, EmailMessage, EmailMessageHeader, EmailMessageSummary, EmailModifyLabelsInput, EmailModifyLabelsOutput, EmailModifyLabelsRequest, EmailMoveInput, EmailMoveMessageOutput, EmailMoveRequest, EmailSecurity, EmailSendMessageInput, EmailSendMessageOutput, EmailSendMessageRequest, EmailSentCopyOutput, EmailSentCopyRequest, EmailSentCopyStatus, EmailSetFlagInput, EmailSetFlagOutput, EmailSetFlagRequest, EmailSetReadInput, EmailSetReadOutput, EmailSetReadRequest, EmailSmtpConnection, EmailSmtpCredentialSlot, EmailSmtpProtocol, EmailTrashInput, EmailTrashRequest, EmailUntrashInput, EmailUntrashRequest, downloadEmailAttachment, emailActions, emailBatchModifyLabelsAction, emailBatchMoveAction, emailBatchSetFlagAction, emailBatchSetReadAction, emailBatchTrashAction, emailBatchUntrashAction, emailConnectorId, emailCreateDraftAction, emailDeletePermanentlyAction, emailGetAttachmentAction, emailGetMessageAction, emailIncomingCredentialSlotId, emailIncomingHostConfigKey, emailIncomingPortConfigKey, emailIncomingProtocolConfigKey, emailIncomingSecurityConfigKey, emailListMessagesAction, emailModifyLabelsAction, emailMoveAction, emailSendMessageAction, emailSetFlagAction, emailSetReadAction, emailSmtpCredentialSlotId, emailSmtpHostConfigKey, emailSmtpPortConfigKey, emailSmtpProtocolConfigKey, emailSmtpSecurityConfigKey, emailTrashAction, emailUntrashAction };
|
|
1153
1170
|
|
|
1154
1171
|
//# sourceMappingURL=index.mjs.map
|