@dxos/compute 0.16.0 → 0.17.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 (136) hide show
  1. package/dist/lib/AiMetering.mjs +1 -0
  2. package/dist/lib/Hook.mjs +1 -0
  3. package/dist/lib/Operation.mjs +3 -3
  4. package/dist/lib/Process.mjs +2 -2
  5. package/dist/lib/Trace.mjs +1 -1
  6. package/dist/lib/chunk-AgentIdentity.mjs +1 -1
  7. package/dist/lib/chunk-AgentService.mjs.map +1 -1
  8. package/dist/lib/chunk-AiMetering.mjs +77 -0
  9. package/dist/lib/chunk-AiMetering.mjs.map +1 -0
  10. package/dist/lib/chunk-Cancellation.mjs +1 -1
  11. package/dist/lib/chunk-Hook.mjs +78 -0
  12. package/dist/lib/chunk-Hook.mjs.map +1 -0
  13. package/dist/lib/chunk-Instructions.mjs +1 -1
  14. package/dist/lib/chunk-Operation.mjs +169 -5
  15. package/dist/lib/chunk-Operation.mjs.map +1 -1
  16. package/dist/lib/chunk-OperationHandlerSet.mjs +1 -1
  17. package/dist/lib/chunk-OperationRegistry.mjs +1 -1
  18. package/dist/lib/chunk-OperationRegistry.mjs.map +1 -1
  19. package/dist/lib/chunk-Process.mjs +18 -10
  20. package/dist/lib/chunk-Process.mjs.map +1 -1
  21. package/dist/lib/chunk-Project.mjs +52 -24
  22. package/dist/lib/chunk-Project.mjs.map +1 -1
  23. package/dist/lib/chunk-Reducer.mjs +827 -0
  24. package/dist/lib/chunk-Reducer.mjs.map +1 -0
  25. package/dist/lib/chunk-Routine.mjs +1 -1
  26. package/dist/lib/chunk-Runnable.mjs +1 -1
  27. package/dist/lib/chunk-ServiceResolver.mjs +1 -1
  28. package/dist/lib/chunk-Skill.mjs +10 -47
  29. package/dist/lib/chunk-Skill.mjs.map +1 -1
  30. package/dist/lib/chunk-Spec.mjs +49 -0
  31. package/dist/lib/chunk-Spec.mjs.map +1 -0
  32. package/dist/lib/chunk-SpecReview.mjs +98 -0
  33. package/dist/lib/chunk-SpecReview.mjs.map +1 -0
  34. package/dist/lib/chunk-SqlService.mjs.map +1 -1
  35. package/dist/lib/chunk-StorageService.mjs +1 -1
  36. package/dist/lib/chunk-Template.mjs +2 -2
  37. package/dist/lib/chunk-Trace.mjs +97 -13
  38. package/dist/lib/chunk-Trace.mjs.map +1 -1
  39. package/dist/lib/chunk-Trajectory.mjs +326 -0
  40. package/dist/lib/chunk-Trajectory.mjs.map +1 -0
  41. package/dist/lib/chunk-Transcript.mjs +84 -0
  42. package/dist/lib/chunk-Transcript.mjs.map +1 -0
  43. package/dist/lib/chunk-definitions.mjs +1 -1
  44. package/dist/lib/errors.mjs +3 -1
  45. package/dist/lib/errors.mjs.map +1 -1
  46. package/dist/lib/index.mjs +14 -8
  47. package/dist/lib/testing.mjs +2 -2
  48. package/dist/lib/trajectory/Reducer.mjs +1 -0
  49. package/dist/lib/trajectory/Trajectory.mjs +1 -0
  50. package/dist/lib/trajectory/Transcript.mjs +1 -0
  51. package/dist/lib/types/Project.mjs +1 -1
  52. package/dist/lib/types/Skill.mjs +1 -1
  53. package/dist/lib/types/Spec.mjs +1 -0
  54. package/dist/lib/types/SpecReview.mjs +1 -0
  55. package/dist/types/src/AgentService.d.ts +9 -0
  56. package/dist/types/src/AgentService.d.ts.map +1 -1
  57. package/dist/types/src/AiMetering.d.ts +23 -0
  58. package/dist/types/src/AiMetering.d.ts.map +1 -0
  59. package/dist/types/src/AiMetering.test.d.ts +2 -0
  60. package/dist/types/src/AiMetering.test.d.ts.map +1 -0
  61. package/dist/types/src/Hook.d.ts +84 -0
  62. package/dist/types/src/Hook.d.ts.map +1 -0
  63. package/dist/types/src/Hook.test.d.ts +2 -0
  64. package/dist/types/src/Hook.test.d.ts.map +1 -0
  65. package/dist/types/src/Operation.d.ts +276 -2
  66. package/dist/types/src/Operation.d.ts.map +1 -1
  67. package/dist/types/src/Process.d.ts +26 -4
  68. package/dist/types/src/Process.d.ts.map +1 -1
  69. package/dist/types/src/Script.test.d.ts +2 -0
  70. package/dist/types/src/Script.test.d.ts.map +1 -0
  71. package/dist/types/src/Trace.d.ts +103 -1
  72. package/dist/types/src/Trace.d.ts.map +1 -1
  73. package/dist/types/src/errors.d.ts +30 -0
  74. package/dist/types/src/errors.d.ts.map +1 -1
  75. package/dist/types/src/index.d.ts +3 -1
  76. package/dist/types/src/index.d.ts.map +1 -1
  77. package/dist/types/src/trajectory/Reducer.d.ts +191 -0
  78. package/dist/types/src/trajectory/Reducer.d.ts.map +1 -0
  79. package/dist/types/src/trajectory/Reducer.test.d.ts +2 -0
  80. package/dist/types/src/trajectory/Reducer.test.d.ts.map +1 -0
  81. package/dist/types/src/trajectory/Trajectory.d.ts +3211 -0
  82. package/dist/types/src/trajectory/Trajectory.d.ts.map +1 -0
  83. package/dist/types/src/trajectory/Trajectory.test.d.ts +2 -0
  84. package/dist/types/src/trajectory/Trajectory.test.d.ts.map +1 -0
  85. package/dist/types/src/trajectory/Transcript.d.ts +40 -0
  86. package/dist/types/src/trajectory/Transcript.d.ts.map +1 -0
  87. package/dist/types/src/trajectory/index.d.ts +4 -0
  88. package/dist/types/src/trajectory/index.d.ts.map +1 -0
  89. package/dist/types/src/trajectory/light-threads.test.d.ts +2 -0
  90. package/dist/types/src/trajectory/light-threads.test.d.ts.map +1 -0
  91. package/dist/types/src/trajectory/samples.test.d.ts +2 -0
  92. package/dist/types/src/trajectory/samples.test.d.ts.map +1 -0
  93. package/dist/types/src/types/Project.d.ts +11 -12
  94. package/dist/types/src/types/Project.d.ts.map +1 -1
  95. package/dist/types/src/types/Skill.d.ts +6 -51
  96. package/dist/types/src/types/Skill.d.ts.map +1 -1
  97. package/dist/types/src/types/Spec.d.ts +26 -0
  98. package/dist/types/src/types/Spec.d.ts.map +1 -0
  99. package/dist/types/src/types/SpecReview.d.ts +76 -0
  100. package/dist/types/src/types/SpecReview.d.ts.map +1 -0
  101. package/dist/types/src/types/index.d.ts +2 -0
  102. package/dist/types/src/types/index.d.ts.map +1 -1
  103. package/dist/types/tsconfig.tsbuildinfo +1 -1
  104. package/package.json +59 -26
  105. package/src/AgentService.ts +9 -0
  106. package/src/AiMetering.test.ts +89 -0
  107. package/src/AiMetering.ts +93 -0
  108. package/src/Hook.test.ts +75 -0
  109. package/src/Hook.ts +154 -0
  110. package/src/Operation.test.ts +23 -0
  111. package/src/Operation.ts +334 -0
  112. package/src/Process.ts +33 -6
  113. package/src/Script.test.ts +74 -0
  114. package/src/Trace.ts +97 -4
  115. package/src/errors.ts +3 -0
  116. package/src/index.ts +3 -1
  117. package/src/trajectory/Reducer.test.ts +575 -0
  118. package/src/trajectory/Reducer.ts +1026 -0
  119. package/src/trajectory/Trajectory.test.ts +114 -0
  120. package/src/trajectory/Trajectory.ts +440 -0
  121. package/src/trajectory/Transcript.ts +113 -0
  122. package/src/trajectory/index.ts +7 -0
  123. package/src/trajectory/light-threads.test.ts +310 -0
  124. package/src/trajectory/samples.test.ts +285 -0
  125. package/src/types/Project.test.ts +2 -1
  126. package/src/types/Project.ts +43 -27
  127. package/src/types/Skill.ts +6 -61
  128. package/src/types/Spec.ts +68 -0
  129. package/src/types/SpecReview.ts +98 -0
  130. package/src/types/index.ts +2 -0
  131. package/dist/lib/McpServer.mjs +0 -1
  132. package/dist/lib/chunk-McpServer.mjs +0 -124
  133. package/dist/lib/chunk-McpServer.mjs.map +0 -1
  134. package/dist/types/src/McpServer.d.ts +0 -113
  135. package/dist/types/src/McpServer.d.ts.map +0 -1
  136. package/src/McpServer.ts +0 -142
@@ -6,33 +6,50 @@
6
6
 
7
7
  import * as Schema from 'effect/Schema';
8
8
 
9
- import { SessionConfig } from '@dxos/ai';
10
9
  import { Annotation, DXN, Format, Obj, Ref, Type } from '@dxos/echo';
10
+ import { PropertyMetaAnnotationId } from '@dxos/echo/internal';
11
11
  import { ArchivableAnnotation } from '@dxos/schema';
12
- import { Outline, Repo, TaskSet } from '@dxos/types';
12
+ import { Outline, type Task, TaskSet } from '@dxos/types';
13
13
 
14
14
  import * as Instructions from './Instructions.ts';
15
15
  import * as Routine from './Routine.ts';
16
16
  import * as Skill from './Skill.ts';
17
+ import * as Spec from './Spec.ts';
17
18
 
18
19
  /** Work-stream lifecycle state; what done means lives on the task set's milestones. */
19
20
  export const ProjectStatus = Schema.Literals(['active', 'paused', 'blocked', 'ended']);
20
21
  export type ProjectStatus = Schema.Schema.Type<typeof ProjectStatus>;
21
22
 
23
+ export const ProjectStatusOptions: Task.Option<ProjectStatus>[] = [
24
+ { id: 'active', title: 'Active', color: 'green', icon: 'ph--play-circle--regular' },
25
+ { id: 'paused', title: 'Paused', color: 'amber', icon: 'ph--pause-circle--regular' },
26
+ { id: 'blocked', title: 'Blocked', color: 'rose', icon: 'ph--prohibit--regular' },
27
+ { id: 'ended', title: 'Ended', color: 'neutral', icon: 'ph--check-circle--regular' },
28
+ ];
29
+
22
30
  /**
23
31
  * A user-facing container for interactive, long-running work: instructions (skills + commands),
24
32
  * artifacts, tasks, and AI chat sessions in project context. Successor to `Topic`.
25
33
  *
26
34
  * Fields are the refs the project owns and orders; everything that merely accumulates around it is
27
- * a query — chats by the ECHO parent edge, agents via chats.
35
+ * a query — chats by the ECHO parent edge, agents via chats. What only some projects need, such as the
36
+ * repositories coding agents work on, is an annotation the plugin that needs it adds.
28
37
  */
29
- export class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.project', '0.6.0'))(
38
+ export class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.project', '0.8.0'))(
30
39
  Schema.Struct({
31
40
  name: Schema.optional(Schema.String),
32
41
  description: Schema.optional(Format.Text),
33
42
 
34
43
  /** Work-stream lifecycle state. */
35
- status: Schema.optional(ProjectStatus),
44
+ status: Schema.optional(
45
+ ProjectStatus.pipe(
46
+ Format.FormatAnnotation.set(Format.TypeFormat.SingleSelect),
47
+ Schema.annotate({
48
+ title: 'Status',
49
+ [PropertyMetaAnnotationId]: { singleSelect: { options: ProjectStatusOptions } },
50
+ }),
51
+ ),
52
+ ),
36
53
 
37
54
  /** Owned agent instructions (created at the plugin layer; parented by `SetParent`). */
38
55
  instructions: Schema.optional(
@@ -54,30 +71,17 @@ export class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.pr
54
71
  /** Ad hoc markdown checklist — the scratch surface; project chats write into it. */
55
72
  outline: Schema.optional(Ref.Ref(Outline.Outline).pipe(Annotation.SetParent.set())),
56
73
 
57
- /** Owned (or adopted synced) task container, holding the project's tasks and milestones. */
58
- taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet).pipe(Annotation.SetParent.set())),
59
-
60
- /**
61
- * Source repository this project's work lands in. Independent of `taskSet`: a project that
62
- * mirrors a repository adopts its synced task set AND names it here, while a project whose
63
- * tasks are local can still reference the repository its issues are filed against.
64
- */
65
- // TODO(burdon): Change to array? Move into taskSet?
66
- repo: Schema.optional(Ref.Ref(Repo.Repo).annotate({ title: 'Repository' })),
67
-
68
74
  /**
69
- * Repositories the project's coding agents work on. A cloud session checks each one out in its
70
- * sandbox; a session on this computer works in the folder chosen for the project there.
75
+ * Owned specs, in order: the normative text the project's tasks deliver. A form creates each and edits it inline.
76
+ * Suspended because Spec refers back.
71
77
  */
72
- repositories: Schema.optional(
73
- Schema.Array(Ref.Ref(Repo.Repo)).annotate({
74
- title: 'Repositories',
75
- description: 'Checked out for coding agents that run in the cloud.',
76
- }),
78
+ specs: Schema.Array(Schema.suspend((): Ref.RefSchema<Spec.Spec> => Ref.Ref(Spec.Spec))).pipe(
79
+ Annotation.SetParent.set(),
80
+ Annotation.FormCreateAnnotation.set(Type.getTypename(Spec.Spec)),
77
81
  ),
78
82
 
79
- /** The default configuration (model, ...) for the sessions this project starts; a chat's own overrides it. */
80
- session: Schema.optional(SessionConfig.SessionConfig.pipe(Annotation.FormInputAnnotation.set(false))),
83
+ /** Owned (or adopted synced) task container, holding the project's tasks and milestones. */
84
+ taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet).pipe(Annotation.SetParent.set())),
81
85
  }).pipe(
82
86
  Schema.annotate({ title: 'Project' }),
83
87
  Annotation.LabelAnnotation.set(['name']),
@@ -99,11 +103,17 @@ export class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.pr
99
103
  * and nothing to draft in. The parent edges follow from the fields' `SetParent` annotation.
100
104
  */
101
105
  export const make = (
102
- props: Omit<Partial<Obj.MakeProps<typeof Project>>, 'artifacts' | 'routines'> & {
106
+ props: Omit<Partial<Obj.MakeProps<typeof Project>>, 'artifacts' | 'routines' | 'specs'> & {
103
107
  artifacts?: ReadonlyArray<Ref.Ref<Obj.Unknown>>;
108
+ specs?: ReadonlyArray<Ref.Ref<Spec.Spec>>;
104
109
  } = {},
105
110
  ): Project => {
106
- const project = Obj.make(Project, { ...props, artifacts: props.artifacts ?? [], routines: [] });
111
+ const project = Obj.make(Project, {
112
+ ...props,
113
+ artifacts: props.artifacts ?? [],
114
+ routines: [],
115
+ specs: props.specs ?? [],
116
+ });
107
117
  if (!props.taskSet) {
108
118
  const taskSet = TaskSet.make();
109
119
  Obj.update(project, (project) => {
@@ -120,6 +130,12 @@ export const make = (
120
130
  };
121
131
 
122
132
  /** Adds a routine to the project as an owned child; `SetParent` on the field cascades it. */
133
+ /** The project that owns the spec: its ECHO parent; undefined for a spec no project owns. */
134
+ export const getOwner = (spec: Spec.Spec): Project | undefined => {
135
+ const parent = Obj.getParent(spec);
136
+ return Obj.instanceOf(Project, parent) ? parent : undefined;
137
+ };
138
+
123
139
  export const addRoutine = (project: Project, routine: Routine.Routine): void => {
124
140
  Obj.update(project, (project) => {
125
141
  project.routines.push(Ref.make(routine));
@@ -16,16 +16,20 @@ import { BaseError } from '@dxos/errors';
16
16
  // eslint-disable-next-line unused-imports/no-unused-imports
17
17
  import { type Text } from '@dxos/schema';
18
18
 
19
- import * as McpServer from '../McpServer.ts';
20
19
  import * as Operation from '../Operation.ts';
21
20
  import * as Template from './Template.ts';
22
- import * as Trigger from './Trigger.ts';
23
21
 
24
22
  /**
25
23
  * Skill schema defines the structure for AI assistant skills.
26
24
  * Skills contain instructions, tools, and artifacts that guide the AI's behavior.
27
25
  * Skills may use tools to create and read artifacts, which are managed by the assistant.
28
26
  *
27
+ * Follows the Agent Skills spec (https://agentskills.io/specification) as closely as it can, so a skill
28
+ * means the same here as in any other harness. Add a field the spec lacks only with a strong reason,
29
+ * and say what it is. Credentials and MCP servers do not belong here: a server is a connection, which
30
+ * the space owns and each conversation can turn off. Nor do hooks: a plugin contributes those beside its
31
+ * skills (`@dxos/compute/Hook`).
32
+ *
29
33
  * The registry `key` and `version` are stored in the object meta — access them via
30
34
  * `Obj.getMeta(skill).key` and `Obj.getMeta(skill).version`.
31
35
  */
@@ -66,16 +70,6 @@ export class Skill extends Type.makeObject<Skill>(DXN.make('org.dxos.type.skill'
66
70
  agentCanEnable: Schema.optional(Schema.Boolean).annotate({
67
71
  description: 'Whether an agent is allowed to auto-enable this skill in a conversation.',
68
72
  }),
69
-
70
- /**
71
- * Array of MCP servers that the AI assistant can use when this skill is active.
72
- */
73
- mcpServers: Schema.optional(Schema.Array(McpServer.Spec)),
74
-
75
- /**
76
- * Hooks triggered automatically at certain points in the agent's lifecycle.
77
- */
78
- hooks: Schema.optional(Schema.Array(Schema.suspend(() => Hook))),
79
73
  }).pipe(
80
74
  Annotation.LabelAnnotation.set(['name']),
81
75
  Annotation.IconAnnotation.set({ icon: 'ph--student--regular', hue: 'amber' }),
@@ -83,55 +77,6 @@ export class Skill extends Type.makeObject<Skill>(DXN.make('org.dxos.type.skill'
83
77
  ),
84
78
  ) {}
85
79
 
86
- /**
87
- * Controls when the hook is triggered.
88
- */
89
- export const HookSpec = Schema.Union([
90
- /**
91
- * Triggered when the agent is about to start a request.
92
- * A request is a series of agent/tool turns that the model drives.
93
- */
94
- Schema.TaggedStruct('begin-request', {}),
95
- /**
96
- * Triggered when the agent has completed a request.
97
- * A request is a series of agent/tool turns that the model drives.
98
- */
99
- Schema.TaggedStruct('end-request', {}),
100
- ]);
101
-
102
- /**
103
- * Allows hooking into the agent's lifecycle.
104
- * NOTE: Intentionally similar to Trigger, perhaps we should merge them.
105
- */
106
- export const Hook = Schema.Struct({
107
- /**
108
- * What to do when the hook is triggered.
109
- *
110
- * Can be a Ref to a PersistentOperation.
111
- */
112
- function: Schema.optional(Ref.Ref(Obj.Unknown).annotate({ title: 'Function' })),
113
-
114
- /**
115
- * Controls when the hook is triggered.
116
- */
117
- spec: HookSpec,
118
-
119
- /**
120
- * Passed as the input data to the function.
121
- * Must match the function's input schema.
122
- */
123
- input: Trigger.InputTemplate.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),
124
-
125
- /**
126
- * Run in the background (end-request only): the request settles without waiting for the hook, and
127
- * the agent process awaits it before it finishes. For work the user should not wait on, e.g.
128
- * reviewing the turn that just ended.
129
- */
130
- async: Schema.optional(Schema.Boolean.annotate({ title: 'Run in background' })),
131
- });
132
-
133
- export type Hook = Schema.Schema.Type<typeof Hook>;
134
-
135
80
  /**
136
81
  * Create a new Skill.
137
82
  * The `key` (and optional `version`) are stored in the object meta.
@@ -0,0 +1,68 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { Annotation, DXN, Format, Obj, Ref, Type } from '@dxos/echo';
10
+ import { FactoryAnnotation, Text } from '@dxos/schema';
11
+
12
+ import * as Skill from './Skill.ts';
13
+
14
+ /**
15
+ * A spec: normative `.mdl` text that its project's work delivers. Its dialects say which block kinds beyond the core
16
+ * and changelog ones the text uses, which a plugin then extracts into objects of its own and keeps as annotations on
17
+ * the spec. A project owns its specs (`Project.specs`), so a spec is not a type of its own in a space. A `.mdl` file's
18
+ * front matter is the spec's fields and meta rather than its text: `name` is `name`, `id` and `version` are the
19
+ * meta's `key` and `version`.
20
+ */
21
+ export class Spec extends Type.makeObject<Spec>(DXN.make('org.dxos.type.projects.spec', '0.4.0'))(
22
+ Schema.Struct({
23
+ name: Schema.String.pipe(Schema.annotate({ title: 'Name' })),
24
+
25
+ description: Schema.optional(
26
+ Schema.String.pipe(
27
+ Format.FormatAnnotation.set(Format.TypeFormat.Markdown),
28
+ Schema.annotate({
29
+ title: 'Description',
30
+ description: 'What the spec describes when its work is complete.',
31
+ }),
32
+ ),
33
+ ),
34
+
35
+ /**
36
+ * The ids of the dialect specs whose blocks the text uses, as a `.mdl` file lists them in its front matter's
37
+ * `extends`. Empty means the core and changelog blocks only.
38
+ */
39
+ dialects: Schema.Array(Schema.String).pipe(Annotation.FormInputAnnotation.set(false)),
40
+
41
+ /** The `.mdl` text; owned, so it is deleted with the spec. */
42
+ content: Ref.Ref(Text.Text).pipe(Annotation.SetParent.set(), Annotation.FormInputAnnotation.set(false)),
43
+ }).pipe(
44
+ Annotation.LabelAnnotation.set(['name']),
45
+ Annotation.IconAnnotation.set({ icon: 'ph--blueprint--regular', hue: 'violet' }),
46
+ // The feature-map skill edits a spec's blocks, so an agent bound to a spec (a comment on it) can change them. Plain
47
+ // dotted key, so the type does not depend on the plugin that owns the skill.
48
+ Skill.SkillsAnnotation.set(['org.dxos.skill.code.featureMap']),
49
+ // A form's create needs the backing text, which `Obj.make` alone leaves out.
50
+ FactoryAnnotation.set((values): unknown => make({ name: '', ...values })),
51
+ ),
52
+ ) {}
53
+
54
+ export type MakeProps = Omit<Obj.MakeProps<typeof Spec>, 'dialects' | 'content'> &
55
+ Partial<Pick<Obj.MakeProps<typeof Spec>, 'dialects'>> & {
56
+ /** The `.mdl` text, without front matter; empty by default. */
57
+ content?: string;
58
+ };
59
+
60
+ /** `dialects` starts as an empty list so two peers lazily creating it cannot each write a fresh one. */
61
+ export const make = ({ content, dialects = [], ...props }: MakeProps): Spec =>
62
+ Obj.make(Spec, {
63
+ ...props,
64
+ dialects: [...dialects],
65
+ content: Ref.make(Text.make({ content: content ?? '' })),
66
+ });
67
+
68
+ export const instanceOf = (value: unknown): value is Spec => Obj.instanceOf(Spec, value);
@@ -0,0 +1,98 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Option from 'effect/Option';
8
+ import * as Schema from 'effect/Schema';
9
+
10
+ import { Annotation, DXN, Filter, Obj, Query, Ref, Type } from '@dxos/echo';
11
+
12
+ import * as Spec from './Spec.ts';
13
+
14
+ /**
15
+ * How far the code meets one spec item, least severe first: `done` as specified, `untested` present but with no test
16
+ * that covers it, `partial` in part, `diverged` implemented differently from what the spec says, `missing` not at all.
17
+ */
18
+ export const VerdictStatus = Schema.Literals(['done', 'untested', 'partial', 'diverged', 'missing']);
19
+ export type VerdictStatus = Schema.Schema.Type<typeof VerdictStatus>;
20
+
21
+ /** One segment of a walkthrough: a sentence and the `github:` key of the code it describes. */
22
+ export const WalkthroughStep = Schema.Struct({ text: Schema.String, key: Schema.String });
23
+ export interface WalkthroughStep extends Schema.Schema.Type<typeof WalkthroughStep> {}
24
+
25
+ /** A review's judgement of one spec item. */
26
+ export const Verdict = Schema.Struct({
27
+ status: VerdictStatus,
28
+ summary: Schema.optional(Schema.String),
29
+ note: Schema.optional(Schema.String),
30
+ /** `github:` keys of the code that supports the verdict. */
31
+ evidence: Schema.Array(Schema.String),
32
+ /** `github:` keys of the tests that exercise the item. */
33
+ tests: Schema.Array(Schema.String),
34
+ /** Where each part of the item is implemented, in reading order. */
35
+ walkthrough: Schema.Array(WalkthroughStep),
36
+ });
37
+ export interface Verdict extends Schema.Schema.Type<typeof Verdict> {}
38
+
39
+ /**
40
+ * One compliance review of a spec: which commit's code was read, when and by whom, and a verdict per spec item. The
41
+ * format is fixed (a `.review.mdl` file's), so a review is created whole and never edited by hand. A spec's history
42
+ * is its reviews; an item's current status is its newest verdict in any of them.
43
+ */
44
+ export class SpecReview extends Type.makeObject<SpecReview>(DXN.make('org.dxos.type.projects.specReview', '0.1.0'))(
45
+ Schema.Struct({
46
+ spec: Ref.Ref(Spec.Spec),
47
+ /** The commit the code was read at. */
48
+ commit: Schema.String,
49
+ /** When the review was made: `YYYY-MM-DD`, or `YYYY-MM-DDTHH:MMZ` in UTC to order the reviews of one day. */
50
+ date: Schema.String,
51
+ /** Who made it: `user:<handle>` or `agent:<name>`. */
52
+ by: Schema.String,
53
+ summary: Schema.optional(Schema.String),
54
+ /** Keyed by spec item id: a block (`Scene`, `F-3`) or a nested requirement (`F-3.2`). */
55
+ verdicts: Schema.Record(Schema.String, Verdict),
56
+ }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--seal-check--regular', hue: 'violet' })),
57
+ ) {}
58
+
59
+ /** The reviews a spec holds; the refs make the spec each review's owner, so deleting the spec deletes them. */
60
+ export const ReviewsAnnotation = Annotation.make({
61
+ id: 'org.dxos.projects.reviews',
62
+ schema: Schema.Array(Ref.Ref(SpecReview)),
63
+ });
64
+
65
+ export type MakeProps = Omit<Obj.MakeProps<typeof SpecReview>, 'spec'> & { spec: Spec.Spec };
66
+
67
+ /** A review listed on and owned by its spec, so it is deleted with the spec. */
68
+ export const make = ({ spec, ...props }: MakeProps): SpecReview => {
69
+ const review = Obj.make(SpecReview, { [Obj.Parent]: spec, ...props, spec: Ref.make(spec) });
70
+ const ref = Ref.make(review);
71
+ if (Option.isNone(Annotation.get(spec, ReviewsAnnotation))) {
72
+ Obj.update(spec, (spec) => {
73
+ Annotation.set(spec, ReviewsAnnotation, [ref]);
74
+ });
75
+ } else {
76
+ // Appended in place, so two peers recording reviews each keep theirs.
77
+ Annotation.update(spec, ReviewsAnnotation, (reviews) => {
78
+ reviews.push(ref);
79
+ });
80
+ }
81
+ return review;
82
+ };
83
+
84
+ export const instanceOf = (value: unknown): value is SpecReview => Obj.instanceOf(SpecReview, value);
85
+
86
+ /** The reviews of a spec; none without one. */
87
+ export const query = (spec: Spec.Spec | undefined) =>
88
+ Query.select(spec ? Filter.id(spec.id) : Filter.nothing()).referencedBy(SpecReview, 'spec');
89
+
90
+ /** Whether two reviews are the same one: the same commit, date and reviewer. */
91
+ export const sameReview = (
92
+ a: Pick<SpecReview, 'commit' | 'date' | 'by'>,
93
+ b: Pick<SpecReview, 'commit' | 'date' | 'by'>,
94
+ ) => a.commit === b.commit && a.date === b.date && a.by === b.by;
95
+
96
+ /** Newest first, by review date; a date with a time orders after that day's plain date. */
97
+ export const byNewest = (a: Pick<SpecReview, 'date'>, b: Pick<SpecReview, 'date'>): number =>
98
+ b.date.localeCompare(a.date);
@@ -7,6 +7,8 @@ export * as Project from './Project.ts';
7
7
  export * as Routine from './Routine.ts';
8
8
  export * as Script from './Script.ts';
9
9
  export * as Skill from './Skill.ts';
10
+ export * as Spec from './Spec.ts';
11
+ export * as SpecReview from './SpecReview.ts';
10
12
  export * as Template from './Template.ts';
11
13
  export * as Trigger from './Trigger.ts';
12
14
  export * as TriggerEvent from './TriggerEvent.ts';
@@ -1 +0,0 @@
1
- export { t as McpServer, r as OAuthState, i as OAuthTokens, a as Spec, o as oauthStore } from "./chunk-McpServer.mjs";
@@ -1,124 +0,0 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Schema from "effect/Schema";
3
- import { Annotation, DXN, Obj, Ref, Type } from "@dxos/echo";
4
- import { AccessToken } from "@dxos/link";
5
- //#region src/McpServer.ts
6
- var McpServer_exports = /* @__PURE__ */ __exportAll({
7
- McpServer: () => McpServer,
8
- OAuthState: () => OAuthState,
9
- OAuthTokens: () => OAuthTokens,
10
- Spec: () => Spec,
11
- oauthStore: () => oauthStore
12
- });
13
- /**
14
- * MCP server connection spec — the minimal fields needed to dial an MCP server.
15
- *
16
- * Used as a value type embedded in skills and passed to runtime session connect logic.
17
- * The user-facing ECHO object ({@link McpServer}) composes this struct and adds instance-level
18
- * fields (`enabled`, credentials) and ECHO annotations.
19
- */
20
- var Spec = Schema.Struct({
21
- name: Schema.String.pipe(Schema.optional).annotate({ description: "Human-readable name of the MCP server" }),
22
- url: Schema.String.annotate({ description: "URL of the MCP server" }),
23
- /**
24
- * Transport protocol. Prefer `'http'` (Streamable HTTP) for new servers; `'sse'` is
25
- * kept for compatibility with servers that haven't migrated and is deprecated per
26
- * the MCP SDK. Clients support both during the migration period.
27
- */
28
- protocol: Schema.Union([Schema.Literal("http"), Schema.Literal("sse")]).annotate({ description: "Transport protocol of the MCP server (prefer \"http\"; \"sse\" deprecated)" }),
29
- /**
30
- * Optional API key sent as a Bearer token.
31
- * Persisted in plaintext wherever the spec is stored; a space-level {@link McpServer} references an
32
- * `AccessToken` instead.
33
- */
34
- apiKey: Schema.optional(Schema.String).annotate({ description: "Optional API key sent with requests" })
35
- });
36
- /**
37
- * Tokens issued to Composer by the server's authorization server (MCP authorization, OAuth 2.1).
38
- */
39
- var OAuthTokens = Schema.Struct({
40
- accessToken: Schema.String,
41
- tokenType: Schema.String,
42
- refreshToken: Schema.optional(Schema.String),
43
- /** Epoch milliseconds; absent when the server did not say. */
44
- expiresAt: Schema.optional(Schema.Number),
45
- scope: Schema.optional(Schema.String)
46
- });
47
- /**
48
- * OAuth state for a server that requires authorization. The client registration is kept alongside
49
- * the tokens because a refresh must present the same client id the tokens were issued to, and the
50
- * agent refreshing them may be hosted on EDGE rather than in the browser that signed in.
51
- */
52
- var OAuthState = Schema.Struct({
53
- clientId: Schema.String,
54
- clientSecret: Schema.optional(Schema.String),
55
- redirectUrl: Schema.optional(Schema.String),
56
- tokens: Schema.optional(OAuthTokens)
57
- });
58
- /**
59
- * MCP server configuration stored as a space-level ECHO object; every enabled one is connected at
60
- * the start of each agent turn in the space.
61
- *
62
- * NOTE: OAuth tokens and legacy `apiKey` values are stored in plaintext and replicated to all peers
63
- * with access to the space, as are non-managed `AccessToken` values.
64
- */
65
- var McpServer = class extends Type.makeObject(DXN.make("org.dxos.type.assistant.mcpServer", "0.1.0"))(Schema.Struct({
66
- ...Spec.fields,
67
- enabled: Schema.optional(Schema.Boolean),
68
- /** Static credential sent as a Bearer token. */
69
- accessToken: Schema.optional(Ref.Ref(AccessToken.AccessToken)),
70
- /** Present once the server has been signed in to via OAuth. */
71
- oauth: Schema.optional(OAuthState)
72
- }).pipe(Annotation.LabelAnnotation.set(["name"]), Annotation.IconAnnotation.set({
73
- icon: "ph--plugs-connected--regular",
74
- hue: "sky"
75
- }))) {};
76
- /**
77
- * The server's OAuth state as the store `@dxos/mcp-client`'s `McpOAuth` provider reads and writes,
78
- * so whichever peer refreshes the tokens (browser or EDGE agent) persists them for the others.
79
- */
80
- var oauthStore = (server) => ({
81
- registration: () => server.oauth && {
82
- clientId: server.oauth.clientId,
83
- clientSecret: server.oauth.clientSecret,
84
- redirectUrl: server.oauth.redirectUrl
85
- },
86
- saveRegistration: (registration) => {
87
- Obj.update(server, (server) => {
88
- if (!registration) {
89
- delete server.oauth;
90
- return;
91
- }
92
- const { clientId, clientSecret, redirectUrl } = registration;
93
- server.oauth = {
94
- clientId,
95
- ...clientSecret !== void 0 && { clientSecret },
96
- ...redirectUrl !== void 0 && { redirectUrl }
97
- };
98
- });
99
- },
100
- tokens: () => server.oauth?.tokens,
101
- saveTokens: (tokens) => {
102
- Obj.update(server, (server) => {
103
- if (server.oauth) {
104
- const { tokens: _previous, ...registration } = server.oauth;
105
- server.oauth = {
106
- ...registration,
107
- ...tokens && { tokens: storedTokens(tokens) }
108
- };
109
- }
110
- });
111
- }
112
- });
113
- /** ECHO keeps an explicit `undefined` as a key, so absent optional fields are left out instead. */
114
- var storedTokens = ({ accessToken, tokenType, refreshToken, expiresAt, scope }) => ({
115
- accessToken,
116
- tokenType,
117
- ...refreshToken !== void 0 && { refreshToken },
118
- ...expiresAt !== void 0 && { expiresAt },
119
- ...scope !== void 0 && { scope }
120
- });
121
- //#endregion
122
- export { Spec as a, OAuthTokens as i, McpServer_exports as n, oauthStore as o, OAuthState as r, McpServer as t };
123
-
124
- //# sourceMappingURL=chunk-McpServer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk-McpServer.mjs","names":[],"sources":["../../src/McpServer.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { AccessToken } from '@dxos/link';\n\n/**\n * MCP server connection spec — the minimal fields needed to dial an MCP server.\n *\n * Used as a value type embedded in skills and passed to runtime session connect logic.\n * The user-facing ECHO object ({@link McpServer}) composes this struct and adds instance-level\n * fields (`enabled`, credentials) and ECHO annotations.\n */\nexport const Spec = Schema.Struct({\n name: Schema.String.pipe(Schema.optional).annotate({\n description: 'Human-readable name of the MCP server',\n }),\n\n url: Schema.String.annotate({\n description: 'URL of the MCP server',\n }),\n\n /**\n * Transport protocol. Prefer `'http'` (Streamable HTTP) for new servers; `'sse'` is\n * kept for compatibility with servers that haven't migrated and is deprecated per\n * the MCP SDK. Clients support both during the migration period.\n */\n protocol: Schema.Union([Schema.Literal('http'), Schema.Literal('sse')]).annotate({\n description: 'Transport protocol of the MCP server (prefer \"http\"; \"sse\" deprecated)',\n }),\n\n /**\n * Optional API key sent as a Bearer token.\n * Persisted in plaintext wherever the spec is stored; a space-level {@link McpServer} references an\n * `AccessToken` instead.\n */\n apiKey: Schema.optional(Schema.String).annotate({\n description: 'Optional API key sent with requests',\n }),\n});\n\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Tokens issued to Composer by the server's authorization server (MCP authorization, OAuth 2.1).\n */\nexport const OAuthTokens = Schema.Struct({\n accessToken: Schema.String,\n tokenType: Schema.String,\n refreshToken: Schema.optional(Schema.String),\n /** Epoch milliseconds; absent when the server did not say. */\n expiresAt: Schema.optional(Schema.Number),\n scope: Schema.optional(Schema.String),\n});\n\nexport type OAuthTokens = Schema.Schema.Type<typeof OAuthTokens>;\n\n/**\n * OAuth state for a server that requires authorization. The client registration is kept alongside\n * the tokens because a refresh must present the same client id the tokens were issued to, and the\n * agent refreshing them may be hosted on EDGE rather than in the browser that signed in.\n */\nexport const OAuthState = Schema.Struct({\n clientId: Schema.String,\n clientSecret: Schema.optional(Schema.String),\n redirectUrl: Schema.optional(Schema.String),\n tokens: Schema.optional(OAuthTokens),\n});\n\nexport type OAuthState = Schema.Schema.Type<typeof OAuthState>;\n\n/**\n * MCP server configuration stored as a space-level ECHO object; every enabled one is connected at\n * the start of each agent turn in the space.\n *\n * NOTE: OAuth tokens and legacy `apiKey` values are stored in plaintext and replicated to all peers\n * with access to the space, as are non-managed `AccessToken` values.\n */\nexport class McpServer extends Type.makeObject<McpServer>(DXN.make('org.dxos.type.assistant.mcpServer', '0.1.0'))(\n Schema.Struct({\n ...Spec.fields,\n enabled: Schema.optional(Schema.Boolean),\n /** Static credential sent as a Bearer token. */\n accessToken: Schema.optional(Ref.Ref(AccessToken.AccessToken)),\n /** Present once the server has been signed in to via OAuth. */\n oauth: Schema.optional(OAuthState),\n }).pipe(\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--plugs-connected--regular', hue: 'sky' }),\n ),\n) {}\n\n/**\n * The server's OAuth state as the store `@dxos/mcp-client`'s `McpOAuth` provider reads and writes,\n * so whichever peer refreshes the tokens (browser or EDGE agent) persists them for the others.\n */\nexport const oauthStore = (server: McpServer) => ({\n registration: () =>\n server.oauth && {\n clientId: server.oauth.clientId,\n clientSecret: server.oauth.clientSecret,\n redirectUrl: server.oauth.redirectUrl,\n },\n saveRegistration: (registration: { clientId: string; clientSecret?: string; redirectUrl?: string } | undefined) => {\n // A new (or discarded) registration invalidates tokens issued to the previous client id.\n Obj.update(server, (server) => {\n if (!registration) {\n delete server.oauth;\n return;\n }\n const { clientId, clientSecret, redirectUrl } = registration;\n server.oauth = {\n clientId,\n ...(clientSecret !== undefined && { clientSecret }),\n ...(redirectUrl !== undefined && { redirectUrl }),\n };\n });\n },\n tokens: () => server.oauth?.tokens,\n saveTokens: (tokens: OAuthTokens | undefined) => {\n Obj.update(server, (server) => {\n if (server.oauth) {\n const { tokens: _previous, ...registration } = server.oauth;\n server.oauth = { ...registration, ...(tokens && { tokens: storedTokens(tokens) }) };\n }\n });\n },\n});\n\n/** ECHO keeps an explicit `undefined` as a key, so absent optional fields are left out instead. */\nconst storedTokens = ({ accessToken, tokenType, refreshToken, expiresAt, scope }: OAuthTokens): OAuthTokens => ({\n accessToken,\n tokenType,\n ...(refreshToken !== undefined && { refreshToken }),\n ...(expiresAt !== undefined && { expiresAt }),\n ...(scope !== undefined && { scope }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAa,OAAO,OAAO,OAAO;CAChC,MAAM,OAAO,OAAO,KAAK,OAAO,QAAQ,CAAC,CAAC,SAAS,EACjD,aAAa,wCACf,CAAC;CAED,KAAK,OAAO,OAAO,SAAS,EAC1B,aAAa,wBACf,CAAC;;;;;;CAOD,UAAU,OAAO,MAAM,CAAC,OAAO,QAAQ,MAAM,GAAG,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/E,aAAa,6EACf,CAAC;;;;;;CAOD,QAAQ,OAAO,SAAS,OAAO,MAAM,CAAC,CAAC,SAAS,EAC9C,aAAa,sCACf,CAAC;AACH,CAAC;;;;AAOD,IAAa,cAAc,OAAO,OAAO;CACvC,aAAa,OAAO;CACpB,WAAW,OAAO;CAClB,cAAc,OAAO,SAAS,OAAO,MAAM;;CAE3C,WAAW,OAAO,SAAS,OAAO,MAAM;CACxC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC;;;;;;AASD,IAAa,aAAa,OAAO,OAAO;CACtC,UAAU,OAAO;CACjB,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,aAAa,OAAO,SAAS,OAAO,MAAM;CAC1C,QAAQ,OAAO,SAAS,WAAW;AACrC,CAAC;;;;;;;;AAWD,IAAa,YAAb,cAA+B,KAAK,WAAsB,IAAI,KAAK,qCAAqC,OAAO,CAAC,CAAC,CAC/G,OAAO,OAAO;CACZ,GAAG,KAAK;CACR,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,aAAa,OAAO,SAAS,IAAI,IAAI,YAAY,WAAW,CAAC;;CAE7D,OAAO,OAAO,SAAS,UAAU;AACnC,CAAC,CAAC,CAAC,KACD,WAAW,gBAAgB,IAAI,CAAC,MAAM,CAAC,GACvC,WAAW,eAAe,IAAI;CAAE,MAAM;CAAgC,KAAK;AAAM,CAAC,CACpF,CACF,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,cAAc,YAAuB;CAChD,oBACE,OAAO,SAAS;EACd,UAAU,OAAO,MAAM;EACvB,cAAc,OAAO,MAAM;EAC3B,aAAa,OAAO,MAAM;CAC5B;CACF,mBAAmB,iBAAgG;EAEjH,IAAI,OAAO,SAAS,WAAW;GAC7B,IAAI,CAAC,cAAc;IACjB,OAAO,OAAO;IACd;GACF;GACA,MAAM,EAAE,UAAU,cAAc,gBAAgB;GAChD,OAAO,QAAQ;IACb;IACA,GAAI,iBAAiB,KAAA,KAAa,EAAE,aAAa;IACjD,GAAI,gBAAgB,KAAA,KAAa,EAAE,YAAY;GACjD;EACF,CAAC;CACH;CACA,cAAc,OAAO,OAAO;CAC5B,aAAa,WAAoC;EAC/C,IAAI,OAAO,SAAS,WAAW;GAC7B,IAAI,OAAO,OAAO;IAChB,MAAM,EAAE,QAAQ,WAAW,GAAG,iBAAiB,OAAO;IACtD,OAAO,QAAQ;KAAE,GAAG;KAAc,GAAI,UAAU,EAAE,QAAQ,aAAa,MAAM,EAAE;IAAG;GACpF;EACF,CAAC;CACH;AACF;;AAGA,IAAM,gBAAgB,EAAE,aAAa,WAAW,cAAc,WAAW,aAAuC;CAC9G;CACA;CACA,GAAI,iBAAiB,KAAA,KAAa,EAAE,aAAa;CACjD,GAAI,cAAc,KAAA,KAAa,EAAE,UAAU;CAC3C,GAAI,UAAU,KAAA,KAAa,EAAE,MAAM;AACrC"}
@@ -1,113 +0,0 @@
1
- import * as Schema from 'effect/Schema';
2
- import { Obj, Type } from '@dxos/echo';
3
- import { AccessToken } from '@dxos/link';
4
- /**
5
- * MCP server connection spec — the minimal fields needed to dial an MCP server.
6
- *
7
- * Used as a value type embedded in skills and passed to runtime session connect logic.
8
- * The user-facing ECHO object ({@link McpServer}) composes this struct and adds instance-level
9
- * fields (`enabled`, credentials) and ECHO annotations.
10
- */
11
- export declare const Spec: Schema.Struct<{
12
- readonly name: Schema.optional<Schema.String>;
13
- readonly url: Schema.String;
14
- /**
15
- * Transport protocol. Prefer `'http'` (Streamable HTTP) for new servers; `'sse'` is
16
- * kept for compatibility with servers that haven't migrated and is deprecated per
17
- * the MCP SDK. Clients support both during the migration period.
18
- */
19
- readonly protocol: Schema.Union<readonly [Schema.Literal<"http">, Schema.Literal<"sse">]>;
20
- /**
21
- * Optional API key sent as a Bearer token.
22
- * Persisted in plaintext wherever the spec is stored; a space-level {@link McpServer} references an
23
- * `AccessToken` instead.
24
- */
25
- readonly apiKey: Schema.optional<Schema.String>;
26
- }>;
27
- export type Spec = Schema.Schema.Type<typeof Spec>;
28
- /**
29
- * Tokens issued to Composer by the server's authorization server (MCP authorization, OAuth 2.1).
30
- */
31
- export declare const OAuthTokens: Schema.Struct<{
32
- readonly accessToken: Schema.String;
33
- readonly tokenType: Schema.String;
34
- readonly refreshToken: Schema.optional<Schema.String>;
35
- /** Epoch milliseconds; absent when the server did not say. */
36
- readonly expiresAt: Schema.optional<Schema.Number>;
37
- readonly scope: Schema.optional<Schema.String>;
38
- }>;
39
- export type OAuthTokens = Schema.Schema.Type<typeof OAuthTokens>;
40
- /**
41
- * OAuth state for a server that requires authorization. The client registration is kept alongside
42
- * the tokens because a refresh must present the same client id the tokens were issued to, and the
43
- * agent refreshing them may be hosted on EDGE rather than in the browser that signed in.
44
- */
45
- export declare const OAuthState: Schema.Struct<{
46
- readonly clientId: Schema.String;
47
- readonly clientSecret: Schema.optional<Schema.String>;
48
- readonly redirectUrl: Schema.optional<Schema.String>;
49
- readonly tokens: Schema.optional<Schema.Struct<{
50
- readonly accessToken: Schema.String;
51
- readonly tokenType: Schema.String;
52
- readonly refreshToken: Schema.optional<Schema.String>;
53
- /** Epoch milliseconds; absent when the server did not say. */
54
- readonly expiresAt: Schema.optional<Schema.Number>;
55
- readonly scope: Schema.optional<Schema.String>;
56
- }>>;
57
- }>;
58
- export type OAuthState = Schema.Schema.Type<typeof OAuthState>;
59
- declare const McpServer_base: Type.ObjClass<McpServer, {
60
- readonly name?: string | undefined;
61
- readonly url: string;
62
- readonly protocol: "http" | "sse";
63
- readonly apiKey?: string | undefined;
64
- readonly enabled?: boolean | undefined;
65
- readonly accessToken?: import("@dxos/echo/internal").Ref<AccessToken.AccessToken & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
66
- readonly oauth?: {
67
- readonly clientId: string;
68
- readonly clientSecret?: string | undefined;
69
- readonly redirectUrl?: string | undefined;
70
- readonly tokens?: {
71
- readonly accessToken: string;
72
- readonly tokenType: string;
73
- readonly refreshToken?: string | undefined;
74
- readonly expiresAt?: number | undefined;
75
- readonly scope?: string | undefined;
76
- } | undefined;
77
- } | undefined;
78
- }, {}>;
79
- /**
80
- * MCP server configuration stored as a space-level ECHO object; every enabled one is connected at
81
- * the start of each agent turn in the space.
82
- *
83
- * NOTE: OAuth tokens and legacy `apiKey` values are stored in plaintext and replicated to all peers
84
- * with access to the space, as are non-managed `AccessToken` values.
85
- */
86
- export declare class McpServer extends McpServer_base {
87
- }
88
- /**
89
- * The server's OAuth state as the store `@dxos/mcp-client`'s `McpOAuth` provider reads and writes,
90
- * so whichever peer refreshes the tokens (browser or EDGE agent) persists them for the others.
91
- */
92
- export declare const oauthStore: (server: McpServer) => {
93
- registration: () => {
94
- clientId: string;
95
- clientSecret: string | undefined;
96
- redirectUrl: string | undefined;
97
- } | undefined;
98
- saveRegistration: (registration: {
99
- clientId: string;
100
- clientSecret?: string;
101
- redirectUrl?: string;
102
- } | undefined) => void;
103
- tokens: () => {
104
- readonly accessToken: string;
105
- readonly tokenType: string;
106
- readonly refreshToken?: string | undefined;
107
- readonly expiresAt?: number | undefined;
108
- readonly scope?: string | undefined;
109
- } | undefined;
110
- saveTokens: (tokens: OAuthTokens | undefined) => void;
111
- };
112
- export {};
113
- //# sourceMappingURL=McpServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"McpServer.d.ts","sourceRoot":"","sources":["../../../src/McpServer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAmB,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;IASf;;;;OAIG;;IAKH;;;;OAIG;;EAIH,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;IAItB,8DAA8D;;;EAG9D,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;QAZrB,8DAA8D;;;;EAiB9D,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;AAE/D;;;;;;GAMG;AACH,qBAAa,SAAU,SAAQ,cAY9B;CAAG;AAEJ;;;GAGG;AACH,eAAO,MAAM,UAAU,WAAY,SAAS;IAC1C,YAAY;;;;;IAMZ,gBAAgB,iBAAiB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAe9G,MAAM;;;;;;;IACN,UAAU,WAAW,WAAW,GAAG,SAAS;CAQ5C,CAAC"}