@finalai/agent-definition 0.5.1 → 0.6.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.
Files changed (90) hide show
  1. package/HOSTING.md +4 -4
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/compiler-assets/{chunk-FU5VHNO4.ts → chunk-3R7MNW5L.ts} +1 -1
  4. package/dist/compiler-assets/{chunk-7KPWSOMK.ts → chunk-3SDZJK7K.ts} +1 -1
  5. package/dist/compiler-assets/{chunk-KTXTYIF4.ts → chunk-4A4EQHYK.ts} +57 -20
  6. package/dist/compiler-assets/{chunk-LZSLGWS7.ts → chunk-4MJF3ALN.ts} +5 -5
  7. package/dist/compiler-assets/{chunk-QVHDGZAN.ts → chunk-4T2URCJZ.ts} +2 -2
  8. package/dist/compiler-assets/{chunk-7MDGEPFT.ts → chunk-6K3WO73F.ts} +1 -1
  9. package/dist/compiler-assets/{chunk-KMBQVNAJ.ts → chunk-AMYJRTAC.ts} +3 -3
  10. package/dist/compiler-assets/{chunk-4T2XPIPH.ts → chunk-BHNF7BEJ.ts} +86 -17
  11. package/dist/compiler-assets/{chunk-U3MFLFVF.ts → chunk-CORCFNEY.ts} +3 -3
  12. package/dist/compiler-assets/{chunk-4ERFBLH7.ts → chunk-DRHDNSCQ.ts} +4 -4
  13. package/dist/compiler-assets/{chunk-O3JKMLDP.ts → chunk-EKR4AEM5.ts} +3 -3
  14. package/dist/compiler-assets/{chunk-MBX6PIN7.ts → chunk-FE7PIPSW.ts} +57 -10
  15. package/dist/compiler-assets/{chunk-YEKSPL76.ts → chunk-FFI2K5IJ.ts} +4 -4
  16. package/dist/compiler-assets/{chunk-36MVFRMA.ts → chunk-IZJMGIAH.ts} +2 -2
  17. package/dist/compiler-assets/{chunk-KTBNDKGJ.ts → chunk-JZTF36V2.ts} +2 -1
  18. package/dist/compiler-assets/{chunk-XJNO7EHQ.ts → chunk-KNYB36DW.ts} +2 -2
  19. package/dist/compiler-assets/{chunk-O2JWY454.ts → chunk-L7YJCQVB.ts} +4 -4
  20. package/dist/compiler-assets/{chunk-WJPAUIVM.ts → chunk-LGGJ6S3U.ts} +1 -1
  21. package/dist/compiler-assets/{chunk-BMX2HP6G.ts → chunk-LIRONA4O.ts} +6 -6
  22. package/dist/compiler-assets/{chunk-GIRUQ7QF.ts → chunk-MM4JCZSK.ts} +7 -7
  23. package/dist/compiler-assets/{chunk-VI5WBWUX.ts → chunk-MPZMRU56.ts} +4 -4
  24. package/dist/compiler-assets/chunk-PLQKTBKO.ts +27 -0
  25. package/dist/compiler-assets/{chunk-EAEQQT33.ts → chunk-Q26ZPNVB.ts} +25 -9
  26. package/dist/compiler-assets/{chunk-Z7HGOUC2.ts → chunk-RTC7AJBS.ts} +1 -1
  27. package/dist/compiler-assets/{chunk-OX46N5EP.ts → chunk-TCXQ4GLM.ts} +1 -1
  28. package/dist/compiler-assets/{chunk-R4IHPPTB.ts → chunk-UUQAHJRT.ts} +2 -2
  29. package/dist/compiler-assets/{chunk-KNFPKVUS.ts → chunk-XCX6VAK7.ts} +1 -1
  30. package/dist/compiler-assets/{chunk-OBFQTLWC.ts → chunk-Y73DOSSB.ts} +3 -3
  31. package/dist/compiler-assets/{chunk-VRW24MOJ.ts → chunk-YAO6DUQO.ts} +4 -4
  32. package/dist/compiler-assets/src/authoring/agent.ts +4 -4
  33. package/dist/compiler-assets/src/authoring/approval.ts +7 -7
  34. package/dist/compiler-assets/src/authoring/brand.ts +3 -3
  35. package/dist/compiler-assets/src/authoring/channels.ts +6 -8
  36. package/dist/compiler-assets/src/authoring/connections.ts +11 -11
  37. package/dist/compiler-assets/src/authoring/credentials.ts +7 -7
  38. package/dist/compiler-assets/src/authoring/dynamic.ts +8 -8
  39. package/dist/compiler-assets/src/authoring/harness.ts +9 -9
  40. package/dist/compiler-assets/src/authoring/hooks.ts +10 -10
  41. package/dist/compiler-assets/src/authoring/index.ts +27 -26
  42. package/dist/compiler-assets/src/authoring/instructions.ts +9 -9
  43. package/dist/compiler-assets/src/authoring/sandbox.ts +11 -11
  44. package/dist/compiler-assets/src/authoring/schedules.ts +4 -4
  45. package/dist/compiler-assets/src/authoring/skills.ts +4 -4
  46. package/dist/compiler-assets/src/authoring/tools.ts +9 -9
  47. package/dist/compiler-assets/src/compatibility.ts +6 -6
  48. package/dist/compiler-assets/src/hosted-bindings.ts +6 -6
  49. package/dist/compiler-assets/src/index.ts +28 -27
  50. package/dist/compiler-assets/src/manifest.ts +4 -4
  51. package/dist/compiler-assets/src/resolve.ts +5 -5
  52. package/dist/compiler-assets/src/runtime/bundle.ts +17 -18
  53. package/dist/compiler-assets/src/runtime/describe.ts +14 -14
  54. package/dist/compiler-assets/src/runtime/described.ts +28 -16
  55. package/dist/compiler-assets/src/runtime/isolate.ts +16 -17
  56. package/dist/compiler-assets/src/runtime/lower.ts +13 -13
  57. package/dist/compiler-assets/src/runtime/schema-validation.ts +4 -4
  58. package/dist/compiler-assets/src/runtime/values.ts +2 -2
  59. package/dist/modules/authoring/agent.d.mts +25 -1
  60. package/dist/modules/authoring/agent.mjs.map +2 -2
  61. package/dist/modules/authoring/brand.d.mts +1 -0
  62. package/dist/modules/authoring/brand.mjs +1 -0
  63. package/dist/modules/authoring/brand.mjs.map +2 -2
  64. package/dist/modules/authoring/channels.d.mts +13 -96
  65. package/dist/modules/authoring/channels.mjs +6 -52
  66. package/dist/modules/authoring/channels.mjs.map +3 -3
  67. package/dist/modules/authoring/index.d.mts +1 -1
  68. package/dist/modules/authoring/index.mjs +2 -0
  69. package/dist/modules/authoring/index.mjs.map +2 -2
  70. package/dist/modules/compiler/assemble.d.mts +0 -4
  71. package/dist/modules/compiler/assemble.mjs +55 -23
  72. package/dist/modules/compiler/assemble.mjs.map +2 -2
  73. package/dist/modules/compiler/bundle.mjs.map +1 -1
  74. package/dist/modules/compiler/index.d.mts +1 -4
  75. package/dist/modules/compiler/index.mjs +4 -3
  76. package/dist/modules/compiler/index.mjs.map +2 -2
  77. package/dist/modules/runtime/describe.mjs +49 -2
  78. package/dist/modules/runtime/describe.mjs.map +2 -2
  79. package/dist/modules/runtime/described.d.mts +94 -3
  80. package/dist/modules/runtime/described.mjs +14 -2
  81. package/dist/modules/runtime/described.mjs.map +2 -2
  82. package/dist/modules/runtime/isolate.d.mts +3 -2
  83. package/dist/modules/runtime/isolate.mjs +2 -0
  84. package/dist/modules/runtime/isolate.mjs.map +2 -2
  85. package/fixtures/release-scout/agent/channels/github.ts +2 -38
  86. package/fixtures/release-scout/agent/hooks/audit.ts +1 -1
  87. package/fixtures/release-scout/agent/instructions/org-context.ts +1 -1
  88. package/package.json +4 -4
  89. package/dist/compiler-assets/chunk-ISYIPH2T.ts +0 -120
  90. package/dist/compiler-assets/chunk-JRKGCYWA.ts +0 -87
@@ -4,24 +4,24 @@ import {
4
4
  describeDynamic,
5
5
  needsCombinedMcpServers,
6
6
  synthesizedExports
7
- } from "../../chunk-MBX6PIN7.ts";
8
- import "../../chunk-GIRUQ7QF.ts";
7
+ } from "../../chunk-FE7PIPSW.ts";
8
+ import "../../chunk-MM4JCZSK.ts";
9
9
  import {
10
10
  COMBINED_MCP_SERVERS_EXPORT
11
11
  } from "../../chunk-NMYHO2QN.ts";
12
- import "../../chunk-4ERFBLH7.ts";
13
- import "../../chunk-O2JWY454.ts";
14
- import "../../chunk-VI5WBWUX.ts";
15
- import "../../chunk-EAEQQT33.ts";
16
- import "../../chunk-36MVFRMA.ts";
17
- import "../../chunk-XJNO7EHQ.ts";
18
- import "../../chunk-O3JKMLDP.ts";
12
+ import "../../chunk-DRHDNSCQ.ts";
13
+ import "../../chunk-L7YJCQVB.ts";
14
+ import "../../chunk-MPZMRU56.ts";
15
+ import "../../chunk-Q26ZPNVB.ts";
16
+ import "../../chunk-IZJMGIAH.ts";
17
+ import "../../chunk-KNYB36DW.ts";
18
+ import "../../chunk-EKR4AEM5.ts";
19
19
  import "../../chunk-7WGYG73V.ts";
20
- import "../../chunk-R4IHPPTB.ts";
21
- import "../../chunk-FU5VHNO4.ts";
22
- import "../../chunk-KTBNDKGJ.ts";
23
- import "../../chunk-OX46N5EP.ts";
24
- import "../../chunk-KTXTYIF4.ts";
20
+ import "../../chunk-UUQAHJRT.ts";
21
+ import "../../chunk-3R7MNW5L.ts";
22
+ import "../../chunk-JZTF36V2.ts";
23
+ import "../../chunk-TCXQ4GLM.ts";
24
+ import "../../chunk-4A4EQHYK.ts";
25
25
  import "../../chunk-32O3ODZE.ts";
26
26
  export {
27
27
  COMBINED_MCP_SERVERS_EXPORT,
@@ -1,27 +1,29 @@
1
1
  import {
2
2
  IssueSeverity
3
- } from "../../chunk-GIRUQ7QF.ts";
3
+ } from "../../chunk-MM4JCZSK.ts";
4
4
  import {
5
5
  SlotKind
6
6
  } from "../../chunk-NMYHO2QN.ts";
7
- import "../../chunk-4ERFBLH7.ts";
8
- import "../../chunk-O2JWY454.ts";
9
- import "../../chunk-VI5WBWUX.ts";
7
+ import "../../chunk-DRHDNSCQ.ts";
8
+ import "../../chunk-L7YJCQVB.ts";
9
+ import "../../chunk-MPZMRU56.ts";
10
10
  import {
11
- agentAvatarSchema
12
- } from "../../chunk-EAEQQT33.ts";
13
- import "../../chunk-36MVFRMA.ts";
14
- import "../../chunk-XJNO7EHQ.ts";
15
- import "../../chunk-O3JKMLDP.ts";
11
+ agentAvatarSchema,
12
+ channelCredentialsSchema,
13
+ channelSurfaceSchema
14
+ } from "../../chunk-Q26ZPNVB.ts";
15
+ import "../../chunk-IZJMGIAH.ts";
16
+ import "../../chunk-KNYB36DW.ts";
17
+ import "../../chunk-EKR4AEM5.ts";
16
18
  import "../../chunk-7WGYG73V.ts";
17
19
  import {
18
20
  hostedBindingRequirementSchema
19
- } from "../../chunk-R4IHPPTB.ts";
21
+ } from "../../chunk-UUQAHJRT.ts";
20
22
  import {
21
23
  jsonValueSchema
22
- } from "../../chunk-FU5VHNO4.ts";
23
- import "../../chunk-KTBNDKGJ.ts";
24
- import "../../chunk-OX46N5EP.ts";
24
+ } from "../../chunk-3R7MNW5L.ts";
25
+ import "../../chunk-JZTF36V2.ts";
26
+ import "../../chunk-TCXQ4GLM.ts";
25
27
  import {
26
28
  array,
27
29
  boolean,
@@ -31,7 +33,7 @@ import {
31
33
  object,
32
34
  record,
33
35
  string
34
- } from "../../chunk-KTXTYIF4.ts";
36
+ } from "../../chunk-4A4EQHYK.ts";
35
37
  import "../../chunk-32O3ODZE.ts";
36
38
 
37
39
  // src/runtime/described.ts
@@ -60,7 +62,14 @@ var describedAgentSchema = object({
60
62
  toolPolicy: record(string(), string()).nullable(),
61
63
  secrets: array(string()).nullable(),
62
64
  channels: array(
63
- object({ key: string().nullable(), channel: jsonValueSchema, config: jsonValueSchema })
65
+ object({
66
+ key: string().nullable(),
67
+ channel: jsonValueSchema,
68
+ config: jsonValueSchema,
69
+ install: string().nullable(),
70
+ credentials: channelCredentialsSchema.nullable(),
71
+ surface: channelSurfaceSchema.nullable()
72
+ })
64
73
  ).nullable()
65
74
  });
66
75
  var describedInstructionsSchema = object({
@@ -89,7 +98,10 @@ var describedHookSchema = object({ type: literal("hook"), keys: array(string())
89
98
  var describedChannelSchema = object({
90
99
  type: literal("channel"),
91
100
  routes: array(object({ method: string(), path: string() })),
92
- turnPolicy: string().nullable(),
101
+ room: boolean(),
102
+ invalidFields: array(string()).default([]),
103
+ credentials: channelCredentialsSchema.nullable(),
104
+ surface: channelSurfaceSchema,
93
105
  config: jsonValueSchema,
94
106
  disabled: boolean().default(false),
95
107
  installed: jsonValueSchema.nullable().default(null)
@@ -2,26 +2,25 @@ import {
2
2
  combineMcpServers,
3
3
  createIsolateRuntime,
4
4
  lowerResolvedValue
5
- } from "../../chunk-4T2XPIPH.ts";
6
- import "../../chunk-GIRUQ7QF.ts";
5
+ } from "../../chunk-BHNF7BEJ.ts";
6
+ import "../../chunk-MM4JCZSK.ts";
7
7
  import "../../chunk-NMYHO2QN.ts";
8
- import "../../chunk-KMBQVNAJ.ts";
9
- import "../../chunk-KNFPKVUS.ts";
10
- import "../../chunk-4ERFBLH7.ts";
11
- import "../../chunk-O2JWY454.ts";
12
- import "../../chunk-JRKGCYWA.ts";
13
- import "../../chunk-VI5WBWUX.ts";
14
- import "../../chunk-EAEQQT33.ts";
8
+ import "../../chunk-AMYJRTAC.ts";
9
+ import "../../chunk-XCX6VAK7.ts";
10
+ import "../../chunk-DRHDNSCQ.ts";
11
+ import "../../chunk-L7YJCQVB.ts";
12
+ import "../../chunk-MPZMRU56.ts";
13
+ import "../../chunk-Q26ZPNVB.ts";
15
14
  import "../../chunk-RWUIMTBI.ts";
16
- import "../../chunk-36MVFRMA.ts";
17
- import "../../chunk-XJNO7EHQ.ts";
18
- import "../../chunk-O3JKMLDP.ts";
15
+ import "../../chunk-IZJMGIAH.ts";
16
+ import "../../chunk-KNYB36DW.ts";
17
+ import "../../chunk-EKR4AEM5.ts";
19
18
  import "../../chunk-7WGYG73V.ts";
20
- import "../../chunk-R4IHPPTB.ts";
21
- import "../../chunk-FU5VHNO4.ts";
22
- import "../../chunk-KTBNDKGJ.ts";
23
- import "../../chunk-OX46N5EP.ts";
24
- import "../../chunk-KTXTYIF4.ts";
19
+ import "../../chunk-UUQAHJRT.ts";
20
+ import "../../chunk-3R7MNW5L.ts";
21
+ import "../../chunk-JZTF36V2.ts";
22
+ import "../../chunk-TCXQ4GLM.ts";
23
+ import "../../chunk-4A4EQHYK.ts";
25
24
  import "../../chunk-32O3ODZE.ts";
26
25
  export {
27
26
  combineMcpServers,
@@ -17,20 +17,20 @@ import {
17
17
  toJson,
18
18
  toJsonSchema,
19
19
  warning
20
- } from "../../chunk-GIRUQ7QF.ts";
21
- import "../../chunk-4ERFBLH7.ts";
22
- import "../../chunk-O2JWY454.ts";
23
- import "../../chunk-VI5WBWUX.ts";
24
- import "../../chunk-EAEQQT33.ts";
25
- import "../../chunk-36MVFRMA.ts";
26
- import "../../chunk-XJNO7EHQ.ts";
27
- import "../../chunk-O3JKMLDP.ts";
20
+ } from "../../chunk-MM4JCZSK.ts";
21
+ import "../../chunk-DRHDNSCQ.ts";
22
+ import "../../chunk-L7YJCQVB.ts";
23
+ import "../../chunk-MPZMRU56.ts";
24
+ import "../../chunk-Q26ZPNVB.ts";
25
+ import "../../chunk-IZJMGIAH.ts";
26
+ import "../../chunk-KNYB36DW.ts";
27
+ import "../../chunk-EKR4AEM5.ts";
28
28
  import "../../chunk-7WGYG73V.ts";
29
- import "../../chunk-R4IHPPTB.ts";
30
- import "../../chunk-FU5VHNO4.ts";
31
- import "../../chunk-KTBNDKGJ.ts";
32
- import "../../chunk-OX46N5EP.ts";
33
- import "../../chunk-KTXTYIF4.ts";
29
+ import "../../chunk-UUQAHJRT.ts";
30
+ import "../../chunk-3R7MNW5L.ts";
31
+ import "../../chunk-JZTF36V2.ts";
32
+ import "../../chunk-TCXQ4GLM.ts";
33
+ import "../../chunk-4A4EQHYK.ts";
34
34
  import "../../chunk-32O3ODZE.ts";
35
35
  export {
36
36
  IssueSeverity,
@@ -5,11 +5,11 @@ import {
5
5
  resultMatchesSchema,
6
6
  standardValidatorSchema,
7
7
  validateSchemaValue
8
- } from "../../chunk-O3JKMLDP.ts";
8
+ } from "../../chunk-EKR4AEM5.ts";
9
9
  import "../../chunk-7WGYG73V.ts";
10
- import "../../chunk-FU5VHNO4.ts";
11
- import "../../chunk-OX46N5EP.ts";
12
- import "../../chunk-KTXTYIF4.ts";
10
+ import "../../chunk-3R7MNW5L.ts";
11
+ import "../../chunk-TCXQ4GLM.ts";
12
+ import "../../chunk-4A4EQHYK.ts";
13
13
  import "../../chunk-32O3ODZE.ts";
14
14
  export {
15
15
  SchemaIo,
@@ -15,8 +15,8 @@ import {
15
15
  messageOf,
16
16
  optionalValueSchema,
17
17
  stringOrNull
18
- } from "../../chunk-OX46N5EP.ts";
19
- import "../../chunk-KTXTYIF4.ts";
18
+ } from "../../chunk-TCXQ4GLM.ts";
19
+ import "../../chunk-4A4EQHYK.ts";
20
20
  import "../../chunk-32O3ODZE.ts";
21
21
  export {
22
22
  authoredRecordSchema,
@@ -5,9 +5,33 @@ export interface HarnessBindingValueIface {
5
5
  readonly config: unknown;
6
6
  }
7
7
  export interface ChannelBindingValueIface {
8
- readonly channel: ProviderRef;
8
+ readonly channel?: ProviderRef;
9
+ readonly installed?: ProviderRef;
10
+ readonly credentials?: {
11
+ app: string | null;
12
+ secrets?: string[];
13
+ };
14
+ readonly routes?: readonly {
15
+ method: string;
16
+ path: string;
17
+ }[];
18
+ readonly listeners?: readonly {
19
+ key: string;
20
+ }[];
21
+ readonly places?: {
22
+ readonly kinds: readonly string[];
23
+ };
24
+ readonly surface?: {
25
+ routes: {
26
+ method: string;
27
+ path: string;
28
+ }[];
29
+ listeners: string[];
30
+ placeKinds: string[];
31
+ };
9
32
  readonly config?: JsonObject;
10
33
  readonly key?: string;
34
+ readonly install?: string;
11
35
  }
12
36
  export interface AgentDefinitionInputIface {
13
37
  readonly name?: string;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/authoring/agent.ts"],
4
- "sourcesContent": ["import type {\n AgentAvatarIface,\n JsonObject,\n ProviderRef,\n ToolApproval,\n} from '@finalai/agent-provider';\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\nimport type { BaseToolsValueIface } from \"./sandbox.mjs\";\n\n// A harness binding as authoring helpers produce it: an installed harness\n// helper (`serverlessPi({...})`), a defineHarness result, or a literal.\nexport interface HarnessBindingValueIface {\n readonly harness: ProviderRef;\n readonly config: unknown;\n}\n\nexport interface ChannelBindingValueIface {\n readonly channel: ProviderRef;\n readonly config?: JsonObject;\n readonly key?: string;\n}\n\n// agent.ts. The agent names its harness; everything\n// the harness has an opinion about (model, reasoning, credentials, permission\n// mode, instructions, skills) lives in `harness.config`.\nexport interface AgentDefinitionInputIface {\n readonly name?: string;\n readonly description?: string;\n /** Static avatar and optional state artwork. */\n readonly avatar?: AgentAvatarIface;\n readonly harness: HarnessBindingValueIface;\n // Base tool capabilities bound to sandbox targets; none unless declared.\n readonly tools?: BaseToolsValueIface;\n // Extra approval policy for MCP tools (`<server>/<tool>`) and base\n // capabilities (`shell`, `files.write`).\n readonly toolPolicy?: Readonly<Record<string, ToolApproval | `${ToolApproval}`>>;\n // Organization secrets this agent's code may read with `ctx.secrets.get(name)`\n // (tools, hooks, resolvers, channel routes). Names referenced elsewhere in the\n // definition (connection `auth.secretKey`, `credentials.apiKey({ secret })`)\n // are added by the compiler; any other secret must be listed here, or reading\n // it fails at run time.\n readonly secrets?: readonly string[];\n // Installed channels (custom channels are files under channels/).\n readonly channels?: readonly ChannelBindingValueIface[];\n}\n\nexport const defineAgent = <TAgent extends AgentDefinitionInputIface>(definition: TAgent): TAgent =>\n stamp({ ...definition }, AuthoredKind.Agent);\n"],
5
- "mappings": "AAMA,SAAS,cAAc,aAAa;AAwC7B,MAAM,cAAc,CAA2C,eACpE,MAAM,EAAE,GAAG,WAAW,GAAG,aAAa,KAAK;",
4
+ "sourcesContent": ["import type {\n AgentAvatarIface,\n JsonObject,\n ProviderRef,\n ToolApproval,\n} from '@finalai/agent-provider';\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\nimport type { BaseToolsValueIface } from \"./sandbox.mjs\";\n\n// A harness binding as authoring helpers produce it: an installed harness\n// helper (`serverlessPi({...})`), a defineHarness result, or a literal.\nexport interface HarnessBindingValueIface {\n readonly harness: ProviderRef;\n readonly config: unknown;\n}\n\nexport interface ChannelBindingValueIface {\n readonly channel?: ProviderRef;\n readonly installed?: ProviderRef;\n readonly credentials?: { app: string | null; secrets?: string[] };\n readonly routes?: readonly { method: string; path: string }[];\n readonly listeners?: readonly { key: string }[];\n readonly places?: { readonly kinds: readonly string[] };\n readonly surface?: {\n routes: { method: string; path: string }[];\n listeners: string[];\n placeKinds: string[];\n };\n readonly config?: JsonObject;\n readonly key?: string;\n readonly install?: string;\n}\n\n// agent.ts. The agent names its harness; everything\n// the harness has an opinion about (model, reasoning, credentials, permission\n// mode, instructions, skills) lives in `harness.config`.\nexport interface AgentDefinitionInputIface {\n readonly name?: string;\n readonly description?: string;\n /** Static avatar and optional state artwork. */\n readonly avatar?: AgentAvatarIface;\n readonly harness: HarnessBindingValueIface;\n // Base tool capabilities bound to sandbox targets; none unless declared.\n readonly tools?: BaseToolsValueIface;\n // Extra approval policy for MCP tools (`<server>/<tool>`) and base\n // capabilities (`shell`, `files.write`).\n readonly toolPolicy?: Readonly<Record<string, ToolApproval | `${ToolApproval}`>>;\n // Organization secrets this agent's code may read with `ctx.secrets.get(name)`\n // (tools, hooks, resolvers, channel routes). Names referenced elsewhere in the\n // definition (connection `auth.secretKey`, `credentials.apiKey({ secret })`)\n // are added by the compiler; any other secret must be listed here, or reading\n // it fails at run time.\n readonly secrets?: readonly string[];\n // Installed channels (custom channels are files under channels/).\n readonly channels?: readonly ChannelBindingValueIface[];\n}\n\nexport const defineAgent = <TAgent extends AgentDefinitionInputIface>(definition: TAgent): TAgent =>\n stamp({ ...definition }, AuthoredKind.Agent);\n"],
5
+ "mappings": "AAMA,SAAS,cAAc,aAAa;AAmD7B,MAAM,cAAc,CAA2C,eACpE,MAAM,EAAE,GAAG,WAAW,GAAG,aAAa,KAAK;",
6
6
  "names": []
7
7
  }
@@ -12,6 +12,7 @@ export declare enum AuthoredKind {
12
12
  HarnessHost = "harness-host",
13
13
  Hook = "hook",
14
14
  Channel = "channel",
15
+ RoomSurface = "room-surface",
15
16
  Approval = "approval"
16
17
  }
17
18
  export declare const stamp: <T extends object>(value: T, kind: AuthoredKind) => T;
@@ -12,6 +12,7 @@ var AuthoredKind = /* @__PURE__ */ ((AuthoredKind2) => {
12
12
  AuthoredKind2["HarnessHost"] = "harness-host";
13
13
  AuthoredKind2["Hook"] = "hook";
14
14
  AuthoredKind2["Channel"] = "channel";
15
+ AuthoredKind2["RoomSurface"] = "room-surface";
15
16
  AuthoredKind2["Approval"] = "approval";
16
17
  return AuthoredKind2;
17
18
  })(AuthoredKind || {});
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/authoring/brand.ts"],
4
- "sourcesContent": ["import { isObjectLike, type AuthoredValue } from \"../runtime/values.mjs\";\n\n// Authored values are plain objects (or functions) registered with their\n// kind, so the compiler's evaluation realm and the isolate runtime recognize\n// them without classes or instanceof. The registry lives in the same realm as\n// the authored code, because the authoring module is bundled with it.\n\nexport enum AuthoredKind {\n Agent = 'agent',\n Tool = 'tool',\n Dynamic = 'dynamic',\n Instructions = 'instructions',\n Skill = 'skill',\n Connection = 'connection',\n Schedule = 'schedule',\n SandboxSelector = 'sandbox-selector',\n BaseTools = 'base-tools',\n HarnessHost = 'harness-host',\n Hook = 'hook',\n Channel = 'channel',\n Approval = 'approval',\n}\n\nconst kinds = new WeakMap<object, AuthoredKind>();\n\nexport const stamp = <T extends object>(value: T, kind: AuthoredKind): T => {\n kinds.set(value, kind);\n return value;\n};\n\nexport const authoredKindOf = (value: AuthoredValue): AuthoredKind | null =>\n isObjectLike(value) ? (kinds.get(value) ?? null) : null;\n\nexport const isAuthored = (value: AuthoredValue, kind: AuthoredKind): boolean =>\n authoredKindOf(value) === kind;\n\n// Values whose bundle export is unknown where they are created (a custom\n// harness, a custom credential resolver): authoring records them in order and\n// hands out a placeholder; the compiler maps each placeholder to a synthesized\n// bundle export. Evaluation order is the bundle's module order, so the\n// compile-time evaluation and the isolate agree on the numbering.\nconst PENDING_PREFIX = '<pending:';\nconst pendingValues: AuthoredValue[] = [];\n\nexport const registerPending = (value: AuthoredValue): string => {\n pendingValues.push(value);\n return `${PENDING_PREFIX}${pendingValues.length - 1}>`;\n};\n\nexport const pendingEntries = (): { placeholder: string; index: number; value: AuthoredValue }[] =>\n pendingValues.map((value, index) => ({\n placeholder: `${PENDING_PREFIX}${index}>`,\n index,\n value,\n }));\n\nexport const pendingIndexOf = (placeholder: string): number | null => {\n const match = /^<pending:(\\d+)>$/.exec(placeholder);\n return match?.[1] == null ? null : Number(match[1]);\n};\n\nexport const pendingExportName = (index: number): string => `pending:${index}`;\n"],
5
- "mappings": "AAA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ects (or functions) registered with their\n// kind, so the compiler's evaluation realm and the isolate runtime recognize\n// them without classes or instanceof. The registry lives in the same realm as\n// the authored code, because the authoring module is bundled with it.\n\nexport enum AuthoredKind {\n Agent = 'agent',\n Tool = 'tool',\n Dynamic = 'dynamic',\n Instructions = 'instructions',\n Skill = 'skill',\n Connection = 'connection',\n Schedule = 'schedule',\n SandboxSelector = 'sandbox-selector',\n BaseTools = 'base-tools',\n HarnessHost = 'harness-host',\n Hook = 'hook',\n Channel = 'channel',\n RoomSurface = 'room-surface',\n Approval = 'approval',\n}\n\nconst kinds = new WeakMap<object, AuthoredKind>();\n\nexport const stamp = <T extends object>(value: T, kind: AuthoredKind): T => {\n kinds.set(value, kind);\n return value;\n};\n\nexport const authoredKindOf = (value: AuthoredValue): AuthoredKind | null =>\n isObjectLike(value) ? (kinds.get(value) ?? null) : null;\n\nexport const isAuthored = (value: AuthoredValue, kind: AuthoredKind): boolean =>\n authoredKindOf(value) === kind;\n\n// Values whose bundle export is unknown where they are created (a custom\n// harness, a custom credential resolver): authoring records them in order and\n// hands out a placeholder; the compiler maps each placeholder to a synthesized\n// bundle export. Evaluation order is the bundle's module order, so the\n// compile-time evaluation and the isolate agree on the numbering.\nconst PENDING_PREFIX = '<pending:';\nconst pendingValues: AuthoredValue[] = [];\n\nexport const registerPending = (value: AuthoredValue): string => {\n pendingValues.push(value);\n return `${PENDING_PREFIX}${pendingValues.length - 1}>`;\n};\n\nexport const pendingEntries = (): { placeholder: string; index: number; value: AuthoredValue }[] =>\n pendingValues.map((value, index) => ({\n placeholder: `${PENDING_PREFIX}${index}>`,\n index,\n value,\n }));\n\nexport const pendingIndexOf = (placeholder: string): number | null => {\n const match = /^<pending:(\\d+)>$/.exec(placeholder);\n return match?.[1] == null ? null : Number(match[1]);\n};\n\nexport const pendingExportName = (index: number): string => `pending:${index}`;\n"],
5
+ "mappings": "AAAA,SAAS,oBAAwC;AAO1C,IAAK,eAAL,kBAAKA,kBAAL;AACL,EAAAA,cAAA,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ChannelEventHandler, ChannelReceiveContextIface, ChannelReceiveResult, ChannelSemanticDataByKindIface, HttpChannelRouteDefinitionIface, JsonObject, JsonValue, DecisionEventKind, ProjectionContextIface, TurnPolicy, WebSocketChannelRouteDefinitionIface } from '@finalai/agent-provider';
2
- export { channelAccessors } from '@finalai/agent-provider';
3
- export type RouteHandler = HttpChannelRouteDefinitionIface['handler'];
4
- export type RouteHandlerArgsIface = Parameters<RouteHandler>[0];
5
- export type AuthoredChannelDefinitionIface = Partial<Omit<ChannelDefinitionIface<JsonValue, JsonValue>, 'turnPolicy' | 'events' | 'receive'>> & {
6
- receive?: (input: JsonValue, ctx: ChannelReceiveContextIface & ChannelAddressContextIface) => Promise<ChannelReceiveResult>;
7
- events?: AuthoredChannelEventsIface;
8
- readonly turnPolicy?: TurnPolicy | `${TurnPolicy}`;
9
- readonly config?: JsonObject;
1
+ import type { ChannelDefinitionIface, HttpChannelRouteDefinitionIface, JsonObject, JsonValue, RouteDefinitionIface, RoomSurfaceDefinitionIface, WebSocketChannelRouteDefinitionIface } from '@finalai/agent-provider';
2
+ export type AuthoredChannelDefinitionIface = ChannelDefinitionIface<JsonObject, JsonValue, JsonValue> & {
10
3
  readonly disabled?: boolean;
11
4
  };
12
- export interface AuthoredChannelContextIface extends ChannelAddressContextIface {
13
- platform: ProjectionContextIface['platform'];
14
- }
15
- export interface AuthoredSessionContextIface {
16
- sessionId: string | null;
17
- turnId: string;
18
- state: ProjectionContextIface['state'];
19
- config: JsonObject;
20
- secrets: ProjectionContextIface['secrets'];
21
- }
22
- export type AuthoredSemanticEventsIface = {
23
- [Kind in keyof ChannelSemanticDataByKindIface]?: (data: ChannelSemanticDataByKindIface[Kind], channel: AuthoredChannelContextIface, ctx: AuthoredSessionContextIface) => void | Promise<void>;
24
- };
25
- type AuthoredSemanticHandlerIface = NonNullable<AuthoredSemanticEventsIface[keyof AuthoredSemanticEventsIface]>;
26
- export type AuthoredChannelEventsIface = AuthoredSemanticEventsIface & {
27
- [Kind in `${DecisionEventKind}` | KnownAcpUpdateKind]?: ChannelEventHandler;
28
- } & {
29
- [kind: AcpUpdateKind]: ChannelEventHandler | AuthoredSemanticHandlerIface | undefined;
30
- };
31
- export declare const defineChannel: <TChannel extends AuthoredChannelDefinitionIface>(definition: TChannel) => Omit<TChannel, "configure" | "installed"> & {
32
- configure: ((config: JsonObject) => ChannelDefinitionIface<JsonValue, JsonValue>) | undefined;
33
- events: {
34
- [kind: string]: AuthoredSemanticHandlerIface | ChannelEventHandler | undefined;
35
- usage_update?: ChannelEventHandler | undefined;
36
- user_message_chunk?: ChannelEventHandler | undefined;
37
- user_message?: ChannelEventHandler | undefined;
38
- agent_message_chunk?: ChannelEventHandler | undefined;
39
- agent_message?: ChannelEventHandler | undefined;
40
- agent_thought_chunk?: ChannelEventHandler | undefined;
41
- agent_thought?: ChannelEventHandler | undefined;
42
- state_update?: ChannelEventHandler | undefined;
43
- tool_call_content_chunk?: ChannelEventHandler | undefined;
44
- tool_call_update?: ChannelEventHandler | undefined;
45
- terminal_update?: ChannelEventHandler | undefined;
46
- terminal_output_chunk?: ChannelEventHandler | undefined;
47
- plan_update?: ChannelEventHandler | undefined;
48
- plan_removed?: ChannelEventHandler | undefined;
49
- available_commands_update?: ChannelEventHandler | undefined;
50
- config_option_update?: ChannelEventHandler | undefined;
51
- session_info_update?: ChannelEventHandler | undefined;
52
- notice?: ChannelEventHandler | undefined;
53
- compaction_update?: ChannelEventHandler | undefined;
54
- compaction_summary_chunk?: ChannelEventHandler | undefined;
55
- subagent_update?: ChannelEventHandler | undefined;
56
- session_message?: ChannelEventHandler | undefined;
57
- session_message_chunk?: ChannelEventHandler | undefined;
58
- "decision.created"?: ChannelEventHandler | undefined;
59
- "decision.resolved"?: ChannelEventHandler | undefined;
60
- };
61
- };
62
- export declare const disableChannel: () => Omit<{
63
- disabled: true;
64
- }, "configure" | "installed"> & {
65
- configure: ((config: JsonObject) => ChannelDefinitionIface<JsonValue, JsonValue>) | undefined;
66
- events: {
67
- [kind: string]: AuthoredSemanticHandlerIface | ChannelEventHandler | undefined;
68
- usage_update?: ChannelEventHandler | undefined;
69
- user_message_chunk?: ChannelEventHandler | undefined;
70
- user_message?: ChannelEventHandler | undefined;
71
- agent_message_chunk?: ChannelEventHandler | undefined;
72
- agent_message?: ChannelEventHandler | undefined;
73
- agent_thought_chunk?: ChannelEventHandler | undefined;
74
- agent_thought?: ChannelEventHandler | undefined;
75
- state_update?: ChannelEventHandler | undefined;
76
- tool_call_content_chunk?: ChannelEventHandler | undefined;
77
- tool_call_update?: ChannelEventHandler | undefined;
78
- terminal_update?: ChannelEventHandler | undefined;
79
- terminal_output_chunk?: ChannelEventHandler | undefined;
80
- plan_update?: ChannelEventHandler | undefined;
81
- plan_removed?: ChannelEventHandler | undefined;
82
- available_commands_update?: ChannelEventHandler | undefined;
83
- config_option_update?: ChannelEventHandler | undefined;
84
- session_info_update?: ChannelEventHandler | undefined;
85
- notice?: ChannelEventHandler | undefined;
86
- compaction_update?: ChannelEventHandler | undefined;
87
- compaction_summary_chunk?: ChannelEventHandler | undefined;
88
- subagent_update?: ChannelEventHandler | undefined;
89
- session_message?: ChannelEventHandler | undefined;
90
- session_message_chunk?: ChannelEventHandler | undefined;
91
- "decision.created"?: ChannelEventHandler | undefined;
92
- "decision.resolved"?: ChannelEventHandler | undefined;
93
- };
5
+ export type RouteHandler = HttpChannelRouteDefinitionIface['handler'];
6
+ export type RouteHandlerArgsIface = Parameters<RouteHandler>[0];
7
+ export declare const defineChannel: <Config = JsonObject, Inbound = JsonValue, State = JsonValue>(definition: ChannelDefinitionIface<Config, Inbound, State>) => ChannelDefinitionIface<Config, Inbound, State>;
8
+ export declare const disableChannel: () => {
9
+ disabled: boolean;
94
10
  };
95
- export declare const GET: (path: string, handler: RouteHandler) => HttpChannelRouteDefinitionIface;
96
- export declare const POST: (path: string, handler: RouteHandler) => HttpChannelRouteDefinitionIface;
97
- export declare const PUT: (path: string, handler: RouteHandler) => HttpChannelRouteDefinitionIface;
98
- export declare const DELETE: (path: string, handler: RouteHandler) => HttpChannelRouteDefinitionIface;
11
+ export declare const defineProviderChannel: <Config = JsonObject, Inbound = JsonValue, State = JsonValue>(definition: ChannelDefinitionIface<Config, Inbound, State>) => ChannelDefinitionIface<Config, Inbound, State>;
12
+ export declare const defineRoomSurface: <T extends RoomSurfaceDefinitionIface<JsonValue, JsonValue>>(definition: T) => T;
13
+ export declare const GET: (path: string, handler: RouteHandler) => RouteDefinitionIface;
14
+ export declare const POST: (path: string, handler: RouteHandler) => RouteDefinitionIface;
15
+ export declare const PUT: (path: string, handler: RouteHandler) => RouteDefinitionIface;
16
+ export declare const DELETE: (path: string, handler: RouteHandler) => RouteDefinitionIface;
99
17
  export declare const WS: (path: string, handler: WebSocketChannelRouteDefinitionIface["handler"]) => WebSocketChannelRouteDefinitionIface;
100
- export declare const defineProviderChannel: <T extends ChannelDefinitionIface<JsonValue, JsonValue>>(definition: T) => T;
@@ -1,69 +1,23 @@
1
- import {
2
- channelAccessors,
3
- channelMessageCompletedSchema,
4
- jsonObjectSchema
5
- } from "@finalai/agent-provider";
6
- import { channelAccessors as channelAccessors2 } from "@finalai/agent-provider";
7
- import * as z from "zod";
8
1
  import { AuthoredKind, stamp } from "./brand.mjs";
9
- const defineChannel = (definition) => {
10
- const {
11
- "message.delta": delta,
12
- "message.completed": completed,
13
- "turn.started": started,
14
- "turn.completed": ended,
15
- ...raw
16
- } = definition.events ?? {};
17
- const events = { ...raw };
18
- const wrap = (schema, handler) => handler == null ? void 0 : async (event, ctx) => handler(
19
- schema.parse(event.data),
20
- { ...channelAccessors(ctx.platform), platform: ctx.platform },
21
- {
22
- sessionId: ctx.sessionId ?? null,
23
- turnId: ctx.turn.id,
24
- state: ctx.state,
25
- config: ctx.config,
26
- secrets: ctx.secrets
27
- }
28
- );
29
- const semantic = {
30
- "message.delta": wrap(z.object({ messageId: z.string(), delta: jsonObjectSchema }), delta),
31
- "message.completed": wrap(channelMessageCompletedSchema, completed),
32
- "turn.started": wrap(z.object({ turnId: z.string() }), started),
33
- "turn.completed": wrap(
34
- z.object({ turnId: z.string(), stopReason: z.string().nullable() }),
35
- ended
36
- )
37
- };
38
- for (const [kind, handler] of Object.entries(semantic))
39
- if (handler != null) events[kind] = handler;
40
- const { installed, configure, ...authored } = definition;
41
- return stamp(
42
- { ...authored, configure: installed == null ? configure : void 0, events },
43
- AuthoredKind.Channel
44
- );
45
- };
46
- const disableChannel = () => defineChannel({ disabled: true });
47
- const route = (method) => (path, handler) => ({
48
- method,
49
- path,
50
- handler
51
- });
2
+ const defineChannel = (definition) => stamp(definition, AuthoredKind.Channel);
3
+ const disableChannel = () => stamp({ disabled: true }, AuthoredKind.Channel);
4
+ const defineProviderChannel = defineChannel;
5
+ const defineRoomSurface = (definition) => stamp(definition, AuthoredKind.RoomSurface);
6
+ const route = (method) => (path, handler) => ({ method, path, handler });
52
7
  const GET = route("GET");
53
8
  const POST = route("POST");
54
9
  const PUT = route("PUT");
55
10
  const DELETE = route("DELETE");
56
11
  const WS = (path, handler) => ({ method: "WS", path, handler });
57
- const defineProviderChannel = (definition) => stamp(definition, AuthoredKind.Channel);
58
12
  export {
59
13
  DELETE,
60
14
  GET,
61
15
  POST,
62
16
  PUT,
63
17
  WS,
64
- channelAccessors2 as channelAccessors,
65
18
  defineChannel,
66
19
  defineProviderChannel,
20
+ defineRoomSurface,
67
21
  disableChannel
68
22
  };
69
23
  //# sourceMappingURL=channels.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/authoring/channels.ts"],
4
- "sourcesContent": ["import type {\n AcpUpdateKind,\n KnownAcpUpdateKind,\n ChannelAddressContextIface,\n ChannelDefinitionIface,\n ChannelEventHandler,\n ChannelReceiveContextIface,\n ChannelReceiveResult,\n ChannelSemanticDataByKindIface,\n HttpChannelRouteDefinitionIface,\n JsonObject,\n JsonValue,\n DecisionEventKind,\n ProjectionContextIface,\n TurnPolicy,\n WebSocketChannelRouteDefinitionIface,\n} from '@finalai/agent-provider';\nimport {\n channelAccessors,\n channelMessageCompletedSchema,\n jsonObjectSchema,\n} from '@finalai/agent-provider';\n\n// Session handles over a projection context's platform (`attachSession(ctx.sessionId)`)\n// for raw event handlers (`decision.created`, ACP updates).\nexport { channelAccessors } from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\n\n// A custom channel in channels/<stem>.ts. Its routes run\n// in the agent's Worker isolate and are mounted by the session service's\n// front door at /<org>/<agent>/<stem><path> (and /b/<bindingId><path>);\n// the members it authors (receive, route, project, events) run there too,\n// driven by the session service exactly like a built-in channel's. What it\n// leaves out is the platform default: receive takes `{ target, content }`,\n// route follows the default routing rules, and the conversation's own channel projects.\n//\n// A bundle channel sees wire ids everywhere (conversations `conv_\u2026`,\n// participants `cpart_\u2026`, messages `cnmsg_\u2026`, users `usr_\u2026`, its binding\n// `chbind_\u2026`, turns `atrn_\u2026`, decisions `adec_\u2026`), the same strings the\n// public API returns, and must pass wire ids back to `ctx.platform`, `receive`\n// results and route decisions; raw UUIDs are refused.\n\nexport type RouteHandler = HttpChannelRouteDefinitionIface['handler'];\nexport type RouteHandlerArgsIface = Parameters<RouteHandler>[0];\n\nexport type AuthoredChannelDefinitionIface = Partial<\n Omit<ChannelDefinitionIface<JsonValue, JsonValue>, 'turnPolicy' | 'events' | 'receive'>\n> & {\n receive?: (\n input: JsonValue,\n ctx: ChannelReceiveContextIface & ChannelAddressContextIface,\n ) => Promise<ChannelReceiveResult>;\n events?: AuthoredChannelEventsIface;\n readonly turnPolicy?: TurnPolicy | `${TurnPolicy}`;\n // Static binding config recorded in the manifest.\n readonly config?: JsonObject;\n readonly disabled?: boolean;\n};\n\nexport interface AuthoredChannelContextIface extends ChannelAddressContextIface {\n platform: ProjectionContextIface['platform'];\n}\nexport interface AuthoredSessionContextIface {\n sessionId: string | null;\n turnId: string;\n state: ProjectionContextIface['state'];\n // The binding's config and the agent's secrets: what a channel needs to post\n // its replies back to its own service.\n config: JsonObject;\n secrets: ProjectionContextIface['secrets'];\n}\nexport type AuthoredSemanticEventsIface = {\n [Kind in keyof ChannelSemanticDataByKindIface]?: (\n data: ChannelSemanticDataByKindIface[Kind],\n channel: AuthoredChannelContextIface,\n ctx: AuthoredSessionContextIface,\n ) => void | Promise<void>;\n};\n\ntype AuthoredSemanticHandlerIface = NonNullable<\n AuthoredSemanticEventsIface[keyof AuthoredSemanticEventsIface]\n>;\n\n// Semantic events (`message.delta`, \u2026) take `(data, channel, ctx)`; decision\n// events and ACP update kinds (`tool_call`, `plan`, \u2026) the raw `(event, ctx)`.\n// Named kinds keep a single handler type, so their parameters are typed from\n// context; ACP kinds the SDK does not name share the open index signature and\n// need annotated parameters.\nexport type AuthoredChannelEventsIface = AuthoredSemanticEventsIface & {\n [Kind in `${DecisionEventKind}` | KnownAcpUpdateKind]?: ChannelEventHandler;\n} & {\n [kind: AcpUpdateKind]: ChannelEventHandler | AuthoredSemanticHandlerIface | undefined;\n};\n\nexport const defineChannel = <TChannel extends AuthoredChannelDefinitionIface>(\n definition: TChannel,\n) => {\n const {\n 'message.delta': delta,\n 'message.completed': completed,\n 'turn.started': started,\n 'turn.completed': ended,\n ...raw\n } = definition.events ?? {};\n const events = { ...raw };\n const wrap = <Data>(\n schema: z.ZodType<Data>,\n handler:\n | ((\n data: Data,\n channel: AuthoredChannelContextIface,\n ctx: AuthoredSessionContextIface,\n ) => void | Promise<void>)\n | undefined,\n ): ChannelEventHandler | undefined =>\n handler == null\n ? undefined\n : async (event, ctx) =>\n handler(\n schema.parse(event.data),\n { ...channelAccessors(ctx.platform), platform: ctx.platform },\n {\n sessionId: ctx.sessionId ?? null,\n turnId: ctx.turn.id,\n state: ctx.state,\n config: ctx.config,\n secrets: ctx.secrets,\n },\n );\n const semantic = {\n 'message.delta': wrap(z.object({ messageId: z.string(), delta: jsonObjectSchema }), delta),\n 'message.completed': wrap(channelMessageCompletedSchema, completed),\n 'turn.started': wrap(z.object({ turnId: z.string() }), started),\n 'turn.completed': wrap(\n z.object({ turnId: z.string(), stopReason: z.string().nullable() }),\n ended,\n ),\n };\n for (const [kind, handler] of Object.entries(semantic))\n if (handler != null) events[kind] = handler;\n const { installed, configure, ...authored } = definition;\n return stamp(\n { ...authored, configure: installed == null ? configure : undefined, events },\n AuthoredKind.Channel,\n );\n};\n\nexport const disableChannel = () => defineChannel({ disabled: true });\n\nconst route =\n (method: HttpChannelRouteDefinitionIface['method']) =>\n (path: string, handler: RouteHandler): HttpChannelRouteDefinitionIface => ({\n method,\n path,\n handler,\n });\n\nexport const GET = route('GET');\nexport const POST = route('POST');\nexport const PUT = route('PUT');\nexport const DELETE = route('DELETE');\n\nexport const WS = (\n path: string,\n handler: WebSocketChannelRouteDefinitionIface['handler'],\n): WebSocketChannelRouteDefinitionIface => ({ method: 'WS', path, handler });\n\n// Provider factories already own their installed reference and runtime handlers.\nexport const defineProviderChannel = <T extends ChannelDefinitionIface<JsonValue, JsonValue>>(\n definition: T,\n): T => stamp(definition, AuthoredKind.Channel);\n"],
5
- "mappings": "AAiBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,oBAAAA,yBAAwB;AACjC,YAAY,OAAO;AACnB,SAAS,cAAc,aAAa;AAoE7B,MAAM,gBAAgB,CAC3B,eACG;AACH,QAAM;AAAA,IACJ,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,IAClB,GAAG;AAAA,EACL,IAAI,WAAW,UAAU,CAAC;AAC1B,QAAM,SAAS,EAAE,GAAG,IAAI;AACxB,QAAM,OAAO,CACX,QACA,YAQA,WAAW,OACP,SACA,OAAO,OAAO,QACZ;AAAA,IACE,OAAO,MAAM,MAAM,IAAI;AAAA,IACvB,EAAE,GAAG,iBAAiB,IAAI,QAAQ,GAAG,UAAU,IAAI,SAAS;AAAA,IAC5D;AAAA,MACE,WAAW,IAAI,aAAa;AAAA,MAC5B,QAA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DefinitionIface,\n JsonObject,\n JsonValue,\n RouteDefinitionIface,\n RoomSurfaceDefinitionIface,\n WebSocketChannelRouteDefinitionIface,\n} from '@finalai/agent-provider';\nimport { AuthoredKind, stamp } from \"./brand.mjs\";\n\nexport type AuthoredChannelDefinitionIface = ChannelDefinitionIface<\n JsonObject,\n JsonValue,\n JsonValue\n> & { readonly disabled?: boolean };\nexport type RouteHandler = HttpChannelRouteDefinitionIface['handler'];\nexport type RouteHandlerArgsIface = Parameters<RouteHandler>[0];\n\nexport const defineChannel = <Config = JsonObject, Inbound = JsonValue, State = JsonValue>(\n definition: ChannelDefinitionIface<Config, Inbound, State>,\n): ChannelDefinitionIface<Config, Inbound, State> => stamp(definition, AuthoredKind.Channel);\nexport const disableChannel = () => stamp({ disabled: true }, AuthoredKind.Channel);\nexport const defineProviderChannel = defineChannel;\nexport const defineRoomSurface = <T extends RoomSurfaceDefinitionIface<JsonValue, JsonValue>>(\n definition: T,\n): T => stamp(definition, AuthoredKind.RoomSurface);\n\nconst route =\n (method: HttpChannelRouteDefinitionIface['method']) =>\n (path: string, handler: RouteHandler): RouteDefinitionIface => ({ method, path, handler });\nexport const GET = route('GET');\nexport const POST = route('POST');\nexport const PUT = route('PUT');\nexport const DELETE = route('DELETE');\nexport const WS = (\n path: string,\n handler: WebSocketChannelRouteDefinitionIface['handler'],\n): WebSocketChannelRouteDefinitionIface => ({ method: 'WS', path, handler });\n"],
5
+ "mappings": "AASA,SAAS,cAAc,aAAa;AAU7B,MAAM,gBAAgB,CAC3B,eACmD,MAAM,YAAY,aAAa,OAAO;AACpF,MAAM,iBAAiB,MAAM,MAAM,EAAE,UAAU,KAAK,GAAG,aAAa,OAAO;AAC3E,MAAM,wBAAwB;AAC9B,MAAM,oBAAoB,CAC/B,eACM,MAAM,YAAY,aAAa,WAAW;AAElD,MAAM,QACJ,CAAC,WACD,CAAC,MAAc,aAAiD,EAAE,QAAQ,MAAM,QAAQ;AACnF,MAAM,MAAM,MAAM,KAAK;AACvB,MAAM,OAAO,MAAM,MAAM;AACzB,MAAM,MAAM,MAAM,KAAK;AACvB,MAAM,SAAS,MAAM,QAAQ;AAC7B,MAAM,KAAK,CAChB,MACA,aAC0C,EAAE,QAAQ,MAAM,MAAM,QAAQ;",
6
+ "names": []
7
7
  }
@@ -2,7 +2,7 @@ export { defineAgent } from "./agent.mjs";
2
2
  export type { AgentDefinitionInputIface, ChannelBindingValueIface, HarnessBindingValueIface, } from "./agent.mjs";
3
3
  export { always, never, whenInput } from "./approval.mjs";
4
4
  export type { ApprovalPolicyIface } from "./approval.mjs";
5
- export { DELETE, GET, POST, PUT, WS, defineChannel, defineProviderChannel, disableChannel, } from "./channels.mjs";
5
+ export { DELETE, GET, POST, PUT, WS, defineChannel, defineRoomSurface, defineProviderChannel, disableChannel, } from "./channels.mjs";
6
6
  export type { AuthoredChannelDefinitionIface, RouteHandler, RouteHandlerArgsIface, } from "./channels.mjs";
7
7
  export { defineHostedConnection, defineMcpClientConnection } from "./connections.mjs";
8
8
  export type { HostedConnectionDefinitionIface, McpClientConnectionDefinitionIface, McpConnectionAuthIface, McpConnectionToolsIface, McpToolAnnotationSelectorIface, McpToolSelector, } from "./connections.mjs";
@@ -7,6 +7,7 @@ import {
7
7
  PUT,
8
8
  WS,
9
9
  defineChannel,
10
+ defineRoomSurface,
10
11
  defineProviderChannel,
11
12
  disableChannel
12
13
  } from "./channels.mjs";
@@ -51,6 +52,7 @@ export {
51
52
  defineInstructions,
52
53
  defineMcpClientConnection,
53
54
  defineProviderChannel,
55
+ defineRoomSurface,
54
56
  defineSandbox,
55
57
  defineSandboxProvider,
56
58
  defineSchedule,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/authoring/index.ts"],
4
- "sourcesContent": ["export { defineAgent } from \"./agent.mjs\";\nexport type {\n AgentDefinitionInputIface,\n ChannelBindingValueIface,\n HarnessBindingValueIface,\n} from \"./agent.mjs\";\nexport { always, never, whenInput } from \"./approval.mjs\";\nexport type { ApprovalPolicyIface } from \"./approval.mjs\";\nexport {\n DELETE,\n GET,\n POST,\n PUT,\n WS,\n defineChannel,\n defineProviderChannel,\n disableChannel,\n} from \"./channels.mjs\";\nexport type {\n AuthoredChannelDefinitionIface,\n RouteHandler,\n RouteHandlerArgsIface,\n} from \"./channels.mjs\";\nexport { defineHostedConnection, defineMcpClientConnection } from \"./connections.mjs\";\nexport type {\n HostedConnectionDefinitionIface,\n McpClientConnectionDefinitionIface,\n McpConnectionAuthIface,\n McpConnectionToolsIface,\n McpToolAnnotationSelectorIface,\n McpToolSelector,\n} from \"./connections.mjs\";\nexport * from \"./context.mjs\";\nexport { requireHostedBinding } from '@finalai/agent-provider';\nexport type { HostedBindingsIface } from '@finalai/agent-provider';\nexport { CredentialOwner, CredentialPayer, credentials } from \"./credentials.mjs\";\nexport type { CredentialNode, CredentialPolicyIface } from \"./credentials.mjs\";\nexport { defineDynamic } from \"./dynamic.mjs\";\nexport type { DynamicDefinitionIface, DynamicEventsIface, DynamicSentinelIface } from \"./dynamic.mjs\";\nexport { completeHarnessDescription, defineHarness } from \"./harness.mjs\";\nexport type {\n AuthoredHarnessCloseContextIface,\n AuthoredHarnessDescriptionIface,\n AuthoredHarnessEndpointIface,\n AuthoredHarnessHealthIface,\n AuthoredHarnessIface,\n AuthoredHarnessOpenArgsIface,\n AuthoredHarnessRefContextIface,\n AuthoredHarnessResumeArgsIface,\n AuthoredHarnessSessionRefIface,\n DefinedAuthoredHarnessIface,\n} from \"./harness.mjs\";\nexport { HookEvent, defineHook } from \"./hooks.mjs\";\nexport type {\n HookContextIface,\n HookDefinitionIface,\n HookEventFor,\n HookEventIface,\n HookEventKey,\n} from \"./hooks.mjs\";\nexport { defineInstructions } from \"./instructions.mjs\";\nexport type { DefinedInstructionsIface, InstructionsDefinitionIface } from \"./instructions.mjs\";\nexport {\n SandboxWire,\n baseTools,\n defineSandbox,\n defineSandboxProvider,\n harnessHost,\n} from \"./sandbox.mjs\";\nexport type {\n BaseToolsValueIface,\n HarnessHostIface,\n SandboxSelector,\n SandboxSelectorContextIface,\n SandboxTargetValue,\n} from \"./sandbox.mjs\";\nexport { defineSchedule } from \"./schedules.mjs\";\nexport type { ScheduleInputIface } from \"./schedules.mjs\";\nexport { defineSkill } from \"./skills.mjs\";\nexport type { SkillDefinitionIface } from \"./skills.mjs\";\nexport { defineTool, toolResultFrom } from \"./tools.mjs\";\nexport type {\n DefinedToolIface,\n StandardSchemaLikeIface,\n ToolCallEventDataIface,\n ToolDefinitionIface,\n ToolInputSchema,\n} from \"./tools.mjs\";\n"],
5
- "mappings": "AAAA,SAAS,mBAAmB;AAM5B,SAAS,QAAQ,OAAO,iBAAiB;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,wBAAwB,iCAAiC;AASlE,cAAc;AACd,SAAS,4BAA4B;AAErC,SAAS,iBAAiB,iBAAiB,mBAAmB;AAE9D,SAAS,qBAAqB;AAE9B,SAAS,4BAA4B,qBAAqB;AAa1D,SAAS,WAAW,kBAAkB;AAQtC,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAE5B,SAAS,YAAY,sBAAsB;",
4
+ "sourcesContent": ["export { defineAgent } from \"./agent.mjs\";\nexport type {\n AgentDefinitionInputIface,\n ChannelBindingValueIface,\n HarnessBindingValueIface,\n} from \"./agent.mjs\";\nexport { always, never, whenInput } from \"./approval.mjs\";\nexport type { ApprovalPolicyIface } from \"./approval.mjs\";\nexport {\n DELETE,\n GET,\n POST,\n PUT,\n WS,\n defineChannel,\n defineRoomSurface,\n defineProviderChannel,\n disableChannel,\n} from \"./channels.mjs\";\nexport type {\n AuthoredChannelDefinitionIface,\n RouteHandler,\n RouteHandlerArgsIface,\n} from \"./channels.mjs\";\nexport { defineHostedConnection, defineMcpClientConnection } from \"./connections.mjs\";\nexport type {\n HostedConnectionDefinitionIface,\n McpClientConnectionDefinitionIface,\n McpConnectionAuthIface,\n McpConnectionToolsIface,\n McpToolAnnotationSelectorIface,\n McpToolSelector,\n} from \"./connections.mjs\";\nexport * from \"./context.mjs\";\nexport { requireHostedBinding } from '@finalai/agent-provider';\nexport type { HostedBindingsIface } from '@finalai/agent-provider';\nexport { CredentialOwner, CredentialPayer, credentials } from \"./credentials.mjs\";\nexport type { CredentialNode, CredentialPolicyIface } from \"./credentials.mjs\";\nexport { defineDynamic } from \"./dynamic.mjs\";\nexport type { DynamicDefinitionIface, DynamicEventsIface, DynamicSentinelIface } from \"./dynamic.mjs\";\nexport { completeHarnessDescription, defineHarness } from \"./harness.mjs\";\nexport type {\n AuthoredHarnessCloseContextIface,\n AuthoredHarnessDescriptionIface,\n AuthoredHarnessEndpointIface,\n AuthoredHarnessHealthIface,\n AuthoredHarnessIface,\n AuthoredHarnessOpenArgsIface,\n AuthoredHarnessRefContextIface,\n AuthoredHarnessResumeArgsIface,\n AuthoredHarnessSessionRefIface,\n DefinedAuthoredHarnessIface,\n} from \"./harness.mjs\";\nexport { HookEvent, defineHook } from \"./hooks.mjs\";\nexport type {\n HookContextIface,\n HookDefinitionIface,\n HookEventFor,\n HookEventIface,\n HookEventKey,\n} from \"./hooks.mjs\";\nexport { defineInstructions } from \"./instructions.mjs\";\nexport type { DefinedInstructionsIface, InstructionsDefinitionIface } from \"./instructions.mjs\";\nexport {\n SandboxWire,\n baseTools,\n defineSandbox,\n defineSandboxProvider,\n harnessHost,\n} from \"./sandbox.mjs\";\nexport type {\n BaseToolsValueIface,\n HarnessHostIface,\n SandboxSelector,\n SandboxSelectorContextIface,\n SandboxTargetValue,\n} from \"./sandbox.mjs\";\nexport { defineSchedule } from \"./schedules.mjs\";\nexport type { ScheduleInputIface } from \"./schedules.mjs\";\nexport { defineSkill } from \"./skills.mjs\";\nexport type { SkillDefinitionIface } from \"./skills.mjs\";\nexport { defineTool, toolResultFrom } from \"./tools.mjs\";\nexport type {\n DefinedToolIface,\n StandardSchemaLikeIface,\n ToolCallEventDataIface,\n ToolDefinitionIface,\n ToolInputSchema,\n} from \"./tools.mjs\";\n"],
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAM5B,SAAS,QAAQ,OAAO,iBAAiB;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,wBAAwB,iCAAiC;AASlE,cAAc;AACd,SAAS,4BAA4B;AAErC,SAAS,iBAAiB,iBAAiB,mBAAmB;AAE9D,SAAS,qBAAqB;AAE9B,SAAS,4BAA4B,qBAAqB;AAa1D,SAAS,WAAW,kBAAkB;AAQtC,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAE5B,SAAS,YAAY,sBAAsB;",
6
6
  "names": []
7
7
  }
@@ -17,10 +17,6 @@ export interface AssembleOutputIface {
17
17
  manifest: AgentManifestIface | null;
18
18
  modules: Record<string, string>;
19
19
  sandboxOpeners: Record<string, string>;
20
- channelRoutes: Record<string, {
21
- method: string;
22
- path: string;
23
- }[]>;
24
20
  directoryFields: {
25
21
  instructions: string[];
26
22
  skills: string[];