@dxos/compute 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731

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 (74) hide show
  1. package/dist/lib/neutral/{chunk-RCLYF66G.mjs → chunk-7ETNWNHW.mjs} +3 -3
  2. package/dist/lib/neutral/{chunk-LF2ANNYW.mjs → chunk-CHYJAS4L.mjs} +7 -4
  3. package/dist/lib/neutral/chunk-CHYJAS4L.mjs.map +7 -0
  4. package/dist/lib/neutral/{chunk-VSICPGGY.mjs → chunk-DC4S2HKY.mjs} +9 -9
  5. package/dist/lib/neutral/chunk-DC4S2HKY.mjs.map +7 -0
  6. package/dist/lib/neutral/{chunk-AKVCVI6N.mjs → chunk-HXPMSLL7.mjs} +3 -3
  7. package/dist/lib/neutral/{chunk-SEBWOTOU.mjs → chunk-OKWXDYEB.mjs} +26 -30
  8. package/dist/lib/neutral/chunk-OKWXDYEB.mjs.map +7 -0
  9. package/dist/lib/neutral/{chunk-LRCABAWU.mjs → chunk-T43BXITP.mjs} +3 -3
  10. package/dist/lib/neutral/fib-CAER5YCY.mjs +10 -0
  11. package/dist/lib/neutral/index.mjs +97 -178
  12. package/dist/lib/neutral/index.mjs.map +3 -3
  13. package/dist/lib/neutral/meta.json +1 -1
  14. package/dist/lib/neutral/reply-NWUOJJ3N.mjs +10 -0
  15. package/dist/lib/neutral/sleep-M2ARBDMV.mjs +10 -0
  16. package/dist/lib/neutral/testing/index.mjs +7 -7
  17. package/dist/types/src/Blueprint.d.ts +22 -33
  18. package/dist/types/src/Blueprint.d.ts.map +1 -1
  19. package/dist/types/src/LayerSpec.d.ts +3 -3
  20. package/dist/types/src/LayerSpec.d.ts.map +1 -1
  21. package/dist/types/src/McpServer.d.ts +1 -2
  22. package/dist/types/src/McpServer.d.ts.map +1 -1
  23. package/dist/types/src/Operation.d.ts +49 -19
  24. package/dist/types/src/Operation.d.ts.map +1 -1
  25. package/dist/types/src/OperationHandlerSet.d.ts +2 -0
  26. package/dist/types/src/OperationHandlerSet.d.ts.map +1 -1
  27. package/dist/types/src/Process.d.ts +8 -3
  28. package/dist/types/src/Process.d.ts.map +1 -1
  29. package/dist/types/src/Routine.d.ts +10 -19
  30. package/dist/types/src/Routine.d.ts.map +1 -1
  31. package/dist/types/src/Script.d.ts +3 -4
  32. package/dist/types/src/Script.d.ts.map +1 -1
  33. package/dist/types/src/ServiceResolver.d.ts +5 -4
  34. package/dist/types/src/ServiceResolver.d.ts.map +1 -1
  35. package/dist/types/src/Template.d.ts +5 -6
  36. package/dist/types/src/Template.d.ts.map +1 -1
  37. package/dist/types/src/Trace.d.ts +10 -12
  38. package/dist/types/src/Trace.d.ts.map +1 -1
  39. package/dist/types/src/Trigger.d.ts +61 -19
  40. package/dist/types/src/Trigger.d.ts.map +1 -1
  41. package/dist/types/src/TriggerEvent.d.ts +14 -6
  42. package/dist/types/src/TriggerEvent.d.ts.map +1 -1
  43. package/dist/types/src/testing/definitions.d.ts.map +1 -1
  44. package/dist/types/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +15 -15
  46. package/src/Blueprint.ts +20 -101
  47. package/src/LayerSpec.ts +3 -3
  48. package/src/McpServer.ts +1 -1
  49. package/src/Operation.ts +68 -40
  50. package/src/OperationHandlerSet.test.ts +17 -12
  51. package/src/OperationHandlerSet.ts +8 -1
  52. package/src/Process.ts +13 -4
  53. package/src/Routine.ts +10 -18
  54. package/src/Script.ts +4 -11
  55. package/src/ServiceResolver.ts +5 -4
  56. package/src/Template.test.ts +3 -1
  57. package/src/Template.ts +5 -6
  58. package/src/Trace.ts +11 -17
  59. package/src/Trigger.ts +15 -29
  60. package/src/TriggerEvent.ts +5 -5
  61. package/src/errors.ts +1 -1
  62. package/src/testing/definitions.ts +8 -6
  63. package/dist/lib/neutral/chunk-LF2ANNYW.mjs.map +0 -7
  64. package/dist/lib/neutral/chunk-SEBWOTOU.mjs.map +0 -7
  65. package/dist/lib/neutral/chunk-VSICPGGY.mjs.map +0 -7
  66. package/dist/lib/neutral/fib-ZSJYREBW.mjs +0 -10
  67. package/dist/lib/neutral/reply-YH3BVOUT.mjs +0 -10
  68. package/dist/lib/neutral/sleep-TSPIQ5EY.mjs +0 -10
  69. /package/dist/lib/neutral/{chunk-RCLYF66G.mjs.map → chunk-7ETNWNHW.mjs.map} +0 -0
  70. /package/dist/lib/neutral/{chunk-AKVCVI6N.mjs.map → chunk-HXPMSLL7.mjs.map} +0 -0
  71. /package/dist/lib/neutral/{chunk-LRCABAWU.mjs.map → chunk-T43BXITP.mjs.map} +0 -0
  72. /package/dist/lib/neutral/{fib-ZSJYREBW.mjs.map → fib-CAER5YCY.mjs.map} +0 -0
  73. /package/dist/lib/neutral/{reply-YH3BVOUT.mjs.map → reply-NWUOJJ3N.mjs.map} +0 -0
  74. /package/dist/lib/neutral/{sleep-TSPIQ5EY.mjs.map → sleep-M2ARBDMV.mjs.map} +0 -0
@@ -16,13 +16,13 @@ import {
16
16
  TriggerStateNotFoundError,
17
17
  getHandler,
18
18
  getHandlerByKey
19
- } from "./chunk-LF2ANNYW.mjs";
19
+ } from "./chunk-CHYJAS4L.mjs";
20
20
  import {
21
21
  Operation_exports,
22
22
  PersistentOperation,
23
23
  deserialize,
24
24
  invoke
25
- } from "./chunk-SEBWOTOU.mjs";
25
+ } from "./chunk-OKWXDYEB.mjs";
26
26
  import {
27
27
  __export
28
28
  } from "./chunk-J5LGTIGS.mjs";
@@ -33,24 +33,20 @@ __export(Blueprint_exports, {
33
33
  Blueprint: () => Blueprint,
34
34
  Blueprint_v0_1_0: () => Blueprint_v0_1_0,
35
35
  NotFoundError: () => NotFoundError,
36
- Registry: () => Registry,
37
- RegistryService: () => RegistryService,
38
36
  getKey: () => getKey,
39
37
  getVersion: () => getVersion,
40
38
  make: () => make2,
41
39
  migrations: () => migrations,
40
+ registryURI: () => registryURI,
42
41
  resolve: () => resolve2,
43
42
  toolDefinitions: () => toolDefinitions,
44
43
  upsert: () => upsert
45
44
  });
46
- import * as Context2 from "effect/Context";
47
45
  import * as Effect3 from "effect/Effect";
48
- import * as Layer2 from "effect/Layer";
49
46
  import * as Schema3 from "effect/Schema";
50
47
  import { ToolId } from "@dxos/ai";
51
- import { Annotation, Database as Database3, Filter as Filter2, Migration, Obj, Type } from "@dxos/echo";
48
+ import { DXN, Annotation, Database as Database3, Filter as Filter2, Migration, Obj, Registry, Type, URI } from "@dxos/echo";
52
49
  import { BaseError } from "@dxos/errors";
53
- import { log as log2 } from "@dxos/log";
54
50
 
55
51
  // src/McpServer.ts
56
52
  var McpServer_exports = {};
@@ -96,7 +92,7 @@ __export(Template_exports, {
96
92
  import * as Effect2 from "effect/Effect";
97
93
  import * as Schema2 from "effect/Schema";
98
94
  import { Database as Database2, Ref } from "@dxos/echo";
99
- import { invariant } from "@dxos/invariant";
95
+ import { assertArgument, invariant } from "@dxos/invariant";
100
96
  import { log } from "@dxos/log";
101
97
  import { Text } from "@dxos/schema";
102
98
  import Handlebars from "@dxos/vendor-kbn-handlebars";
@@ -153,7 +149,7 @@ var make = ({ id, source, inputs = [] } = {}) => ({
153
149
  inputs
154
150
  });
155
151
  var process = (source, variables = {}) => {
156
- invariant(typeof source === "string", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 50, S: void 0, A: ["typeof source === 'string'", ""] });
152
+ assertArgument(typeof source === "string", "source");
157
153
  let section = 0;
158
154
  const handlebars = Handlebars.create();
159
155
  handlebars.registerHelper("section", () => String(++section));
@@ -192,7 +188,6 @@ var processTemplate = (template) => Effect2.gen(function* () {
192
188
  });
193
189
 
194
190
  // src/Blueprint.ts
195
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/compute/compute/src/Blueprint.ts";
196
191
  var Blueprint = Schema3.Struct({
197
192
  /**
198
193
  * Human-readable name of the blueprint.
@@ -229,15 +224,12 @@ var Blueprint = Schema3.Struct({
229
224
  * Array of MCP servers that the AI assistant can use when this blueprint is active.
230
225
  */
231
226
  mcpServers: Schema3.optional(Schema3.Array(McpServer))
232
- }).pipe(Type.object({
233
- typename: "org.dxos.type.blueprint",
234
- version: "0.2.0"
235
- }), Annotation.LabelAnnotation.set([
227
+ }).pipe(Annotation.LabelAnnotation.set([
236
228
  "name"
237
229
  ]), Annotation.IconAnnotation.set({
238
230
  icon: "ph--blueprint--regular",
239
231
  hue: "sky"
240
- }));
232
+ }), Type.makeObject(DXN.make("org.dxos.type.blueprint", "0.2.0")));
241
233
  var make2 = ({ key, version, tools = [], instructions = make(), ...props }) => Obj.make(Blueprint, {
242
234
  [Obj.Meta]: {
243
235
  key,
@@ -256,76 +248,13 @@ var getKey = (blueprint) => {
256
248
  };
257
249
  var getVersion = (blueprint) => Obj.getMeta(blueprint).version;
258
250
  var toolDefinitions = ({ tools = [], operations = [] }) => [
259
- ...operations.map((op) => ToolId.make(op.meta.key)),
251
+ ...operations.map((op) => ToolId.make(DXN.getName(op.meta.key))),
260
252
  ...tools.map((tool) => ToolId.make(tool))
261
253
  ];
262
- var Registry = class {
263
- _blueprints = [];
264
- constructor(blueprints) {
265
- const seen = /* @__PURE__ */ new Set();
266
- blueprints.forEach((blueprint) => {
267
- const key = getKey(blueprint);
268
- if (seen.has(key)) {
269
- log2.warn("duplicate blueprint", {
270
- key
271
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 104, S: this });
272
- } else {
273
- seen.add(key);
274
- this._blueprints.push(blueprint);
275
- }
276
- });
277
- this._blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
278
- }
279
- get blueprints() {
280
- return this._blueprints;
281
- }
282
- getByKey(key) {
283
- return this._blueprints.find((blueprint) => Obj.getMeta(blueprint).key === key);
284
- }
285
- query() {
286
- return this._blueprints;
287
- }
288
- updateBlueprints() {
289
- return Effect3.gen(this, function* () {
290
- const blueprints = yield* Database3.runQuery(Filter2.type(Blueprint));
291
- for (const blueprint of blueprints) {
292
- const blueprintKey = Obj.getMeta(blueprint).key;
293
- if (!blueprintKey) {
294
- continue;
295
- }
296
- const registryBlueprint = this.getByKey(blueprintKey);
297
- if (!registryBlueprint) {
298
- continue;
299
- }
300
- const source = Obj.clone(registryBlueprint, {
301
- deep: true
302
- });
303
- Obj.update(blueprint, (blueprint2) => {
304
- void Obj.updateFrom(blueprint2, source);
305
- });
306
- }
307
- }).pipe(Effect3.orDie);
308
- }
309
- };
310
- var RegistryService = class _RegistryService extends Context2.Tag("@dxos/blueprints/RegistryService")() {
311
- static notAvailable = Layer2.succeed(_RegistryService, {
312
- get blueprints() {
313
- throw new Error("Blueprint registry not available");
314
- },
315
- getByKey(_key) {
316
- throw new Error("Blueprint registry not available");
317
- },
318
- query() {
319
- throw new Error("Blueprint registry not available");
320
- },
321
- updateBlueprints() {
322
- throw new Error("Blueprint registry not available");
323
- }
324
- });
325
- };
254
+ var registryURI = (key) => DXN.tryMake(`dxn:${key}`) ?? URI.make(key);
326
255
  var resolve2 = (key) => Effect3.gen(function* () {
327
- const registry = yield* RegistryService;
328
- const blueprint = registry.getByKey(key);
256
+ const results = yield* Registry.runQuery(Filter2.and(Filter2.type(Blueprint), Filter2.key(key)));
257
+ const blueprint = results[0];
329
258
  if (!blueprint) {
330
259
  return yield* Effect3.fail(new NotFoundError({
331
260
  context: {
@@ -362,10 +291,7 @@ var Blueprint_v0_1_0 = Schema3.Struct({
362
291
  tools: Schema3.Array(ToolId),
363
292
  agentCanEnable: Schema3.optional(Schema3.Boolean),
364
293
  mcpServers: Schema3.optional(Schema3.Array(McpServer))
365
- }).pipe(Type.object({
366
- typename: "org.dxos.type.blueprint",
367
- version: "0.1.0"
368
- }));
294
+ }).pipe(Type.makeObject(DXN.make("org.dxos.type.blueprint", "0.1.0")));
369
295
  var _migration = Migration.define({
370
296
  from: Blueprint_v0_1_0,
371
297
  to: Blueprint,
@@ -391,10 +317,10 @@ var Credential_exports = {};
391
317
  __export(Credential_exports, {
392
318
  CredentialsService: () => CredentialsService
393
319
  });
394
- import * as Context3 from "effect/Context";
320
+ import * as Context2 from "effect/Context";
395
321
  import * as Effect4 from "effect/Effect";
396
322
  import * as Redacted from "effect/Redacted";
397
- var CredentialsService = class _CredentialsService extends Context3.Tag("@dxos/functions/CredentialsService")() {
323
+ var CredentialsService = class _CredentialsService extends Context2.Tag("@dxos/functions/CredentialsService")() {
398
324
  static getCredential = (query) => Effect4.gen(function* () {
399
325
  const credentials = yield* _CredentialsService;
400
326
  return yield* Effect4.promise(() => credentials.getCredential(query));
@@ -439,11 +365,12 @@ __export(Process_exports, {
439
365
  make: () => make5,
440
366
  prettyProcessTree: () => prettyProcessTree
441
367
  });
442
- import * as Context5 from "effect/Context";
368
+ import * as Context4 from "effect/Context";
443
369
  import * as Effect6 from "effect/Effect";
444
370
  import * as Schema5 from "effect/Schema";
445
- import { assertArgument } from "@dxos/invariant";
446
- import { log as log4 } from "@dxos/log";
371
+ import { assertArgument as assertArgument2 } from "@dxos/invariant";
372
+ import { DXN as DXN3 } from "@dxos/keys";
373
+ import { log as log3 } from "@dxos/log";
447
374
 
448
375
  // src/Trace.ts
449
376
  var Trace_exports = {};
@@ -475,21 +402,21 @@ __export(Trace_exports, {
475
402
  write: () => write,
476
403
  writerLayerNoop: () => writerLayerNoop
477
404
  });
478
- import * as Context4 from "effect/Context";
405
+ import * as Context3 from "effect/Context";
479
406
  import * as Effect5 from "effect/Effect";
480
- import * as Layer3 from "effect/Layer";
407
+ import * as Layer2 from "effect/Layer";
481
408
  import * as Schema4 from "effect/Schema";
482
- import { Annotation as Annotation2, Obj as Obj2, Type as Type2 } from "@dxos/echo";
483
- import { log as log3 } from "@dxos/log";
484
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/compute/compute/src/Trace.ts";
485
- var TraceService = class extends Context4.Tag("@dxos/functions/TraceService")() {
409
+ import { DXN as DXN2, Annotation as Annotation2, Obj as Obj2, Type as Type2 } from "@dxos/echo";
410
+ import { log as log2 } from "@dxos/log";
411
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/compute/compute/src/Trace.ts";
412
+ var TraceService = class extends Context3.Tag("@dxos/functions/TraceService")() {
486
413
  };
487
414
  function write(eventType, payload) {
488
415
  return Effect5.gen(function* () {
489
- log3("trace write", {
416
+ log2("trace write", {
490
417
  key: eventType.key,
491
418
  isEphemeral: eventType.isEphemeral
492
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 20, S: this });
419
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 20, S: this });
493
420
  const writer = yield* TraceService;
494
421
  writer.write(eventType, payload);
495
422
  });
@@ -551,13 +478,10 @@ var MessageData = Schema4.Struct({
551
478
  isEphemeral: Schema4.Boolean,
552
479
  events: Schema4.Array(Event)
553
480
  });
554
- var Message = MessageData.pipe(Type2.object({
555
- typename: "org.dxos.type.traceMessage",
556
- version: "0.1.0"
557
- }), Annotation2.IconAnnotation.set({
481
+ var Message = MessageData.pipe(Annotation2.IconAnnotation.set({
558
482
  icon: "ph--note--regular",
559
483
  hue: "rose"
560
- }));
484
+ }), Type2.makeObject(DXN2.make("org.dxos.type.traceMessage", "0.1.0")));
561
485
  var flatten3 = (message) => {
562
486
  return message.events.map((event) => ({
563
487
  ...event,
@@ -565,19 +489,19 @@ var flatten3 = (message) => {
565
489
  isEphemeral: message.isEphemeral
566
490
  }));
567
491
  };
568
- var TraceSink = class extends Context4.Tag("@dxos/functions/TraceSink")() {
492
+ var TraceSink = class extends Context3.Tag("@dxos/functions/TraceSink")() {
569
493
  };
570
494
  var noopWriter = {
571
495
  write: () => {
572
496
  }
573
497
  };
574
- var writerLayerNoop = Layer3.succeed(TraceService, noopWriter);
498
+ var writerLayerNoop = Layer2.succeed(TraceService, noopWriter);
575
499
  var noopSink = {
576
500
  write: () => {
577
501
  }
578
502
  };
579
- var layerNoop = Layer3.succeed(TraceSink, noopSink);
580
- var layerConsole = Layer3.succeed(TraceSink, {
503
+ var layerNoop = Layer2.succeed(TraceSink, noopSink);
504
+ var layerConsole = Layer2.succeed(TraceSink, {
581
505
  write: (message) => {
582
506
  console.log(message);
583
507
  }
@@ -598,7 +522,7 @@ var mergeSinks = (sinks) => {
598
522
  }
599
523
  };
600
524
  };
601
- var testTraceService = (opts = {}) => Layer3.effect(TraceService, Effect5.gen(function* () {
525
+ var testTraceService = (opts = {}) => Layer2.effect(TraceService, Effect5.gen(function* () {
602
526
  const sink = yield* TraceSink;
603
527
  const clock = opts.clock ?? Date.now;
604
528
  return {
@@ -622,7 +546,9 @@ var OperationStart = EventType("operation.start", {
622
546
  /** Operation key. */
623
547
  key: Schema4.String,
624
548
  /** Human-readable operation name. */
625
- name: Schema4.optional(Schema4.String)
549
+ name: Schema4.optional(Schema4.String),
550
+ /** Phosphor icon identifier in `ph--<name>--<variant>` format. */
551
+ icon: Schema4.optional(Schema4.String)
626
552
  }),
627
553
  isEphemeral: false
628
554
  });
@@ -632,6 +558,8 @@ var OperationEnd = EventType("operation.end", {
632
558
  key: Schema4.String,
633
559
  /** Human-readable operation name. */
634
560
  name: Schema4.optional(Schema4.String),
561
+ /** Phosphor icon identifier in `ph--<name>--<variant>` format. */
562
+ icon: Schema4.optional(Schema4.String),
635
563
  /** Outcome of the operation. */
636
564
  outcome: Schema4.Literal("success", "failure"),
637
565
  /** Error message if the operation failed. */
@@ -673,12 +601,12 @@ var emitStatus = (message) => write(StatusUpdate, {
673
601
  });
674
602
 
675
603
  // src/Process.ts
676
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/compute/compute/src/Process.ts";
604
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/core/compute/compute/src/Process.ts";
677
605
  var ID = Schema5.String.pipe(Schema5.brand("ProcessId"));
678
606
  var ProcessTypeId = "~@dxos/functions/Process";
679
607
  var isProcess = (executable) => typeof executable === "object" && executable !== null && ProcessTypeId in executable;
680
608
  var make5 = (opts, create) => {
681
- assertArgument(/^[a-z0-9]([a-z0-9.\-/]*[a-z0-9])?$/i.test(opts.key), "key", "Invalid key");
609
+ assertArgument2(/^[a-z0-9]([a-z0-9.\-/]*[a-z0-9])?$/i.test(opts.key), "key", "Invalid key");
682
610
  return {
683
611
  [ProcessTypeId]: {},
684
612
  ...opts,
@@ -692,7 +620,7 @@ var make5 = (opts, create) => {
692
620
  };
693
621
  };
694
622
  var fromOperation = (op, handler) => make5({
695
- key: op.meta.key,
623
+ key: DXN3.getName(op.meta.key),
696
624
  input: op.input,
697
625
  output: op.output,
698
626
  services: op.services
@@ -700,13 +628,14 @@ var fromOperation = (op, handler) => make5({
700
628
  const semaphore = yield* Effect6.makeSemaphore(1);
701
629
  return {
702
630
  onInput: (input) => Effect6.gen(function* () {
703
- log4("operation process invoking", {
631
+ log3("operation process invoking", {
704
632
  key: op.meta.key,
705
633
  name: op.meta.name
706
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 45, S: this });
634
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 46, S: this });
707
635
  yield* write(OperationStart, {
708
636
  key: op.meta.key,
709
- name: op.meta.name
637
+ name: op.meta.name,
638
+ icon: op.meta.icon
710
639
  });
711
640
  yield* write(OperationInput, {
712
641
  key: op.meta.key,
@@ -725,6 +654,7 @@ var fromOperation = (op, handler) => make5({
725
654
  yield* write(OperationEnd, {
726
655
  key: op.meta.key,
727
656
  name: op.meta.name,
657
+ icon: op.meta.icon,
728
658
  outcome: "success"
729
659
  });
730
660
  }).pipe(Effect6.catchAllDefect((defect) => Effect6.gen(function* () {
@@ -732,6 +662,7 @@ var fromOperation = (op, handler) => make5({
732
662
  yield* write(OperationEnd, {
733
663
  key: op.meta.key,
734
664
  name: op.meta.name,
665
+ icon: op.meta.icon,
735
666
  outcome: "failure",
736
667
  error: errorMessage
737
668
  });
@@ -749,7 +680,7 @@ var State = /* @__PURE__ */ (function(State2) {
749
680
  State2["FAILED"] = "FAILED";
750
681
  return State2;
751
682
  })({});
752
- var ProcessMonitorService = class extends Context5.Tag("@dxos/functions/ProcessMonitorService")() {
683
+ var ProcessMonitorService = class extends Context4.Tag("@dxos/functions/ProcessMonitorService")() {
753
684
  };
754
685
  var SpawnedEvent = EventType("process.spawned", {
755
686
  schema: Schema5.Void,
@@ -827,7 +758,8 @@ __export(Routine_exports, {
827
758
  make: () => make6
828
759
  });
829
760
  import * as Schema6 from "effect/Schema";
830
- import { Annotation as Annotation3, JsonSchema, Obj as Obj3, Ref as Ref2, Type as Type3 } from "@dxos/echo";
761
+ import { DXN as DXN4, Annotation as Annotation3, JsonSchema, Obj as Obj3, Ref as Ref2, Type as Type3, Format } from "@dxos/echo";
762
+ import { Text as Text2 } from "@dxos/schema";
831
763
  var Routine = Schema6.Struct({
832
764
  name: Schema6.optional(Schema6.String),
833
765
  description: Schema6.optional(Schema6.String),
@@ -837,30 +769,26 @@ var Routine = Schema6.Struct({
837
769
  output: JsonSchema.JsonSchema.pipe(Annotation3.FormInputAnnotation.set(false)).annotations({
838
770
  description: "Output schema"
839
771
  }),
840
- // TODO(burdon): Form editor.
841
- instructions: Template.pipe(Annotation3.FormInputAnnotation.set(false)).annotations({
772
+ instructions: Ref2.Ref(Text2.Text).pipe(Format.FormatAnnotation.set(Format.TypeFormat.Markdown), Schema6.annotations({
773
+ title: "Instructions",
842
774
  description: "Agent instructions"
843
- }),
775
+ })),
844
776
  blueprints: Schema6.Array(Ref2.Ref(Blueprint)),
845
- // TODO(burdon): Change to map?
846
777
  context: Schema6.Array(Schema6.Any).pipe(Annotation3.FormInputAnnotation.set(false))
847
- }).pipe(Type3.object({
848
- typename: "org.dxos.type.routine",
849
- version: "0.1.0"
850
- }), Annotation3.LabelAnnotation.set([
778
+ }).pipe(Annotation3.LabelAnnotation.set([
851
779
  "name"
852
780
  ]), Annotation3.IconAnnotation.set({
853
781
  icon: "ph--scroll--regular",
854
782
  hue: "sky"
855
- }));
783
+ }), Type3.makeObject(DXN4.make("org.dxos.type.routine", "0.1.0")));
856
784
  var make6 = ({ name, description, input, output, instructions, blueprints = [], context = [] }) => Obj3.make(Routine, {
857
785
  name,
858
786
  description,
859
787
  input: JsonSchema.toJsonSchema(input ?? Schema6.Void),
860
788
  output: JsonSchema.toJsonSchema(output ?? Schema6.Void),
861
- instructions: make({
862
- source: instructions
863
- }),
789
+ instructions: Ref2.make(Text2.make({
790
+ content: instructions ?? ""
791
+ })),
864
792
  blueprints,
865
793
  context
866
794
  });
@@ -872,28 +800,25 @@ __export(Script_exports, {
872
800
  make: () => make7
873
801
  });
874
802
  import * as Schema7 from "effect/Schema";
875
- import { Annotation as Annotation4, Obj as Obj4, Ref as Ref3, Type as Type4 } from "@dxos/echo";
803
+ import { DXN as DXN5, Annotation as Annotation4, Obj as Obj4, Ref as Ref3, Type as Type4 } from "@dxos/echo";
876
804
  import { FormInputAnnotation } from "@dxos/echo/internal";
877
- import { Text as Text2 } from "@dxos/schema";
805
+ import { Text as Text3 } from "@dxos/schema";
878
806
  var Script = Schema7.Struct({
879
807
  name: Schema7.String.pipe(Schema7.optional),
880
808
  description: Schema7.String.pipe(Schema7.optional),
881
809
  // TODO(burdon): Change to hash of deployed content.
882
810
  // Whether source has changed since last deploy.
883
811
  changed: Schema7.Boolean.pipe(FormInputAnnotation.set(false), Schema7.optional),
884
- source: Ref3.Ref(Text2.Text).pipe(FormInputAnnotation.set(false))
885
- }).pipe(Type4.object({
886
- typename: "org.dxos.type.script",
887
- version: "0.1.0"
888
- }), Annotation4.LabelAnnotation.set([
812
+ source: Ref3.Ref(Text3.Text).pipe(FormInputAnnotation.set(false))
813
+ }).pipe(Annotation4.LabelAnnotation.set([
889
814
  "name"
890
815
  ]), Annotation4.IconAnnotation.set({
891
816
  icon: "ph--code--regular",
892
817
  hue: "sky"
893
- }));
818
+ }), Type4.makeObject(DXN5.make("org.dxos.type.script", "0.1.0")));
894
819
  var make7 = ({ source = "", ...props } = {}) => Obj4.make(Script, {
895
820
  ...props,
896
- source: Ref3.make(Text2.make({
821
+ source: Ref3.make(Text3.make({
897
822
  content: source
898
823
  }))
899
824
  });
@@ -911,21 +836,21 @@ __export(ServiceResolver_exports, {
911
836
  provide: () => provide,
912
837
  resolve: () => resolve3,
913
838
  resolveAll: () => resolveAll,
914
- succeed: () => succeed3
839
+ succeed: () => succeed2
915
840
  });
916
- import * as Context6 from "effect/Context";
841
+ import * as Context5 from "effect/Context";
917
842
  import * as Effect7 from "effect/Effect";
918
843
  import * as Either from "effect/Either";
919
- import * as Layer4 from "effect/Layer";
844
+ import * as Layer3 from "effect/Layer";
920
845
  import * as Option from "effect/Option";
921
846
  var ServiceResolverTypeId = "~@dxos/functions/ServiceResolver";
922
- var ServiceResolver = Context6.GenericTag("@dxos/functions/ServiceResolver");
847
+ var ServiceResolver = Context5.GenericTag("@dxos/functions/ServiceResolver");
923
848
  var resolve3 = Effect7.serviceFunctionEffect(ServiceResolver, (_) => _.resolve);
924
849
  var resolveAll = (tags, context) => Effect7.gen(function* () {
925
- const services = yield* Effect7.forEach(tags, (tag) => resolve3(tag, context).pipe(Effect7.map((service) => Context6.make(tag, service))));
926
- return Context6.mergeAll(...services);
850
+ const services = yield* Effect7.forEach(tags, (tag) => resolve3(tag, context).pipe(Effect7.map((service) => Context5.make(tag, service))));
851
+ return Context5.mergeAll(...services);
927
852
  });
928
- var succeed3 = (tag, getService) => {
853
+ var succeed2 = (tag, getService) => {
929
854
  return make9((tag1, context) => {
930
855
  if (tag1.key !== tag.key) {
931
856
  return Effect7.fail(new ServiceNotAvailableError(`Service not available: ${String(tag.key ?? tag)}`));
@@ -939,7 +864,7 @@ var make9 = (resolveFn) => ({
939
864
  resolve: resolveFn
940
865
  });
941
866
  var fromContext = (ctx) => make9((tag, context) => Effect7.gen(function* () {
942
- const service = Context6.getOption(ctx, tag);
867
+ const service = Context5.getOption(ctx, tag);
943
868
  if (Option.isNone(service)) {
944
869
  return yield* Effect7.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
945
870
  }
@@ -948,19 +873,19 @@ var fromContext = (ctx) => make9((tag, context) => Effect7.gen(function* () {
948
873
  var fromRequirements = (...tags) => Effect7.contextWith((parentCtx) => {
949
874
  const available = new Set(tags.map((tag) => tag.key));
950
875
  return make9((tag, context) => Effect7.gen(function* () {
951
- let result = Context6.empty();
876
+ let result = Context5.empty();
952
877
  if (!available.has(tag.key)) {
953
878
  return yield* Effect7.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
954
879
  }
955
- const service = Context6.getOption(parentCtx, tag);
880
+ const service = Context5.getOption(parentCtx, tag);
956
881
  if (Option.isNone(service)) {
957
882
  return yield* Effect7.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
958
883
  }
959
884
  return service.value;
960
885
  }));
961
886
  });
962
- var layerRequirements = (...tags) => Layer4.effect(ServiceResolver, fromRequirements(...tags));
963
- var provide = (context, ...tags) => Layer4.scopedContext(resolveAll(tags, context));
887
+ var layerRequirements = (...tags) => Layer3.effect(ServiceResolver, fromRequirements(...tags));
888
+ var provide = (context, ...tags) => Layer3.scopedContext(resolveAll(tags, context));
964
889
  var compose = (...resolvers) => make9((tag, context) => Effect7.gen(function* () {
965
890
  for (const resolver of resolvers) {
966
891
  const single = yield* resolver.resolve(tag, context).pipe(Effect7.either);
@@ -978,8 +903,8 @@ var empty2 = make9((tag, context) => {
978
903
  var Trigger_exports = {};
979
904
  __export(Trigger_exports, {
980
905
  EmailSpec: () => EmailSpec,
906
+ FeedSpec: () => FeedSpec,
981
907
  Kinds: () => Kinds,
982
- QueueSpec: () => QueueSpec,
983
908
  Spec: () => Spec,
984
909
  SubscriptionSpec: () => SubscriptionSpec,
985
910
  TimerSpec: () => TimerSpec,
@@ -988,20 +913,17 @@ __export(Trigger_exports, {
988
913
  make: () => make10,
989
914
  specEmail: () => specEmail,
990
915
  specFeed: () => specFeed,
991
- specQueue: () => specQueue,
992
916
  specSubscription: () => specSubscription,
993
917
  specTimer: () => specTimer,
994
918
  specWebhook: () => specWebhook
995
919
  });
996
920
  import * as Schema8 from "effect/Schema";
997
921
  import * as SchemaAST from "effect/SchemaAST";
998
- import { Annotation as Annotation5, Feed, Obj as Obj5, QueryAST, Ref as Ref4, Type as Type5 } from "@dxos/echo";
999
- import { OptionsAnnotationId, SystemTypeAnnotation } from "@dxos/echo/internal";
1000
- import { failedInvariant } from "@dxos/invariant";
1001
- import { DXN } from "@dxos/keys";
922
+ import { DXN as DXN6, Annotation as Annotation5, Feed, Obj as Obj5, QueryAST, Ref as Ref4, Type as Type5 } from "@dxos/echo";
923
+ import { OptionsAnnotationId, HiddenAnnotation } from "@dxos/echo/internal";
1002
924
  var Kinds = [
1003
925
  "email",
1004
- "queue",
926
+ "feed",
1005
927
  "subscription",
1006
928
  "timer",
1007
929
  "webhook"
@@ -1015,16 +937,16 @@ var EmailSpec = Schema8.Struct({
1015
937
  var specEmail = () => ({
1016
938
  kind: "email"
1017
939
  });
1018
- var QueueSpec = Schema8.Struct({
1019
- kind: Schema8.Literal("queue").annotations(kindLiteralAnnotations),
1020
- // TODO(dmaretskyi): Rename to `feed` and change to a reference.
1021
- queue: DXN.Schema
940
+ var FeedSpec = Schema8.Struct({
941
+ kind: Schema8.Literal("feed").annotations(kindLiteralAnnotations),
942
+ feed: Schema8.optional(Ref4.Ref(Feed.Feed).annotations({
943
+ title: "Feed"
944
+ }))
1022
945
  });
1023
- var specQueue = (queueDXN) => ({
1024
- kind: "queue",
1025
- queue: queueDXN
946
+ var specFeed = (feed) => ({
947
+ kind: "feed",
948
+ feed: Ref4.make(feed)
1026
949
  });
1027
- var specFeed = (feed) => specQueue(Feed.getQueueDxn(feed)?.toString() ?? failedInvariant(new Error("Could not extract DXN from feed")));
1028
950
  var SubscriptionSpec = Schema8.Struct({
1029
951
  kind: Schema8.Literal("subscription").annotations(kindLiteralAnnotations),
1030
952
  query: Schema8.Struct({
@@ -1087,7 +1009,7 @@ var specWebhook = (opts) => ({
1087
1009
  method: opts?.method,
1088
1010
  port: opts?.port
1089
1011
  });
1090
- var Spec = Schema8.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({
1012
+ var Spec = Schema8.Union(EmailSpec, FeedSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({
1091
1013
  title: "Trigger"
1092
1014
  });
1093
1015
  var TriggerSchema = Schema8.Struct({
@@ -1132,13 +1054,10 @@ var TriggerSchema = Schema8.Struct({
1132
1054
  key: Schema8.String,
1133
1055
  value: Schema8.Any
1134
1056
  }))
1135
- }).pipe(Type5.object({
1136
- typename: "org.dxos.type.trigger",
1137
- version: "0.1.0"
1138
- }), Annotation5.IconAnnotation.set({
1057
+ }).pipe(Annotation5.IconAnnotation.set({
1139
1058
  icon: "ph--lightning--regular",
1140
1059
  hue: "yellow"
1141
- }), SystemTypeAnnotation.set(true));
1060
+ }), HiddenAnnotation.set(true), Type5.makeObject(DXN6.make("org.dxos.type.trigger", "0.1.0")));
1142
1061
  var Trigger = TriggerSchema;
1143
1062
  var make10 = (props) => Obj5.make(Trigger, props);
1144
1063
 
@@ -1146,14 +1065,14 @@ var make10 = (props) => Obj5.make(Trigger, props);
1146
1065
  var TriggerEvent_exports = {};
1147
1066
  __export(TriggerEvent_exports, {
1148
1067
  EmailEvent: () => EmailEvent,
1149
- QueueEvent: () => QueueEvent,
1068
+ FeedEvent: () => FeedEvent,
1150
1069
  SubscriptionEvent: () => SubscriptionEvent,
1151
1070
  TimerEvent: () => TimerEvent,
1152
1071
  TriggerEvent: () => TriggerEvent,
1153
1072
  WebhookEvent: () => WebhookEvent
1154
1073
  });
1155
1074
  import * as Schema9 from "effect/Schema";
1156
- import { DXN as DXN2, Obj as Obj6, Ref as Ref5 } from "@dxos/echo";
1075
+ import { Feed as Feed2, Obj as Obj6, Ref as Ref5 } from "@dxos/echo";
1157
1076
  var EmailEvent = Schema9.Struct({
1158
1077
  from: Schema9.String,
1159
1078
  to: Schema9.String,
@@ -1161,8 +1080,8 @@ var EmailEvent = Schema9.Struct({
1161
1080
  created: Schema9.String,
1162
1081
  body: Schema9.String
1163
1082
  });
1164
- var QueueEvent = Schema9.Struct({
1165
- queue: DXN2.Schema,
1083
+ var FeedEvent = Schema9.Struct({
1084
+ feed: Ref5.Ref(Feed2.Feed),
1166
1085
  item: Schema9.Any,
1167
1086
  cursor: Schema9.String
1168
1087
  });
@@ -1193,7 +1112,7 @@ var WebhookEvent = Schema9.Struct({
1193
1112
  }),
1194
1113
  bodyText: Schema9.String
1195
1114
  });
1196
- var TriggerEvent = Schema9.Union(EmailEvent, QueueEvent, SubscriptionEvent, TimerEvent, WebhookEvent);
1115
+ var TriggerEvent = Schema9.Union(EmailEvent, FeedEvent, SubscriptionEvent, TimerEvent, WebhookEvent);
1197
1116
  export {
1198
1117
  Blueprint_exports as Blueprint,
1199
1118
  Credential_exports as Credential,