@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
@@ -1,18 +1,21 @@
1
1
  import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { s as SkillsAnnotation } from "./chunk-Skill.mjs";
2
+ import { a as SkillsAnnotation } from "./chunk-Skill.mjs";
3
3
  import { n as Instructions } from "./chunk-Instructions.mjs";
4
4
  import { n as Routine } from "./chunk-Routine.mjs";
5
+ import { t as Spec } from "./chunk-Spec.mjs";
5
6
  import * as Schema from "effect/Schema";
7
+ import { Outline, TaskSet } from "@dxos/types";
6
8
  import { Annotation, DXN, Format, Obj, Ref, Type } from "@dxos/echo";
7
9
  import { ArchivableAnnotation } from "@dxos/schema";
8
- import { SessionConfig } from "@dxos/ai";
9
- import { Outline, Repo, TaskSet } from "@dxos/types";
10
+ import { PropertyMetaAnnotationId } from "@dxos/echo/internal";
10
11
  //#region src/types/Project.ts
11
12
  var Project_exports = /* @__PURE__ */ __exportAll({
12
13
  Project: () => Project,
13
14
  ProjectStatus: () => ProjectStatus,
15
+ ProjectStatusOptions: () => ProjectStatusOptions,
14
16
  addRoutine: () => addRoutine,
15
17
  contextBindings: () => contextBindings,
18
+ getOwner: () => getOwner,
16
19
  make: () => make
17
20
  });
18
21
  /** Work-stream lifecycle state; what done means lives on the task set's milestones. */
@@ -22,18 +25,48 @@ var ProjectStatus = Schema.Literals([
22
25
  "blocked",
23
26
  "ended"
24
27
  ]);
28
+ var ProjectStatusOptions = [
29
+ {
30
+ id: "active",
31
+ title: "Active",
32
+ color: "green",
33
+ icon: "ph--play-circle--regular"
34
+ },
35
+ {
36
+ id: "paused",
37
+ title: "Paused",
38
+ color: "amber",
39
+ icon: "ph--pause-circle--regular"
40
+ },
41
+ {
42
+ id: "blocked",
43
+ title: "Blocked",
44
+ color: "rose",
45
+ icon: "ph--prohibit--regular"
46
+ },
47
+ {
48
+ id: "ended",
49
+ title: "Ended",
50
+ color: "neutral",
51
+ icon: "ph--check-circle--regular"
52
+ }
53
+ ];
25
54
  /**
26
55
  * A user-facing container for interactive, long-running work: instructions (skills + commands),
27
56
  * artifacts, tasks, and AI chat sessions in project context. Successor to `Topic`.
28
57
  *
29
58
  * Fields are the refs the project owns and orders; everything that merely accumulates around it is
30
- * a query — chats by the ECHO parent edge, agents via chats.
59
+ * a query — chats by the ECHO parent edge, agents via chats. What only some projects need, such as the
60
+ * repositories coding agents work on, is an annotation the plugin that needs it adds.
31
61
  */
32
- var Project = class extends Type.makeObject(DXN.make("org.dxos.type.project", "0.6.0"))(Schema.Struct({
62
+ var Project = class extends Type.makeObject(DXN.make("org.dxos.type.project", "0.8.0"))(Schema.Struct({
33
63
  name: Schema.optional(Schema.String),
34
64
  description: Schema.optional(Format.Text),
35
65
  /** Work-stream lifecycle state. */
36
- status: Schema.optional(ProjectStatus),
66
+ status: Schema.optional(ProjectStatus.pipe(Format.FormatAnnotation.set(Format.TypeFormat.SingleSelect), Schema.annotate({
67
+ title: "Status",
68
+ [PropertyMetaAnnotationId]: { singleSelect: { options: ProjectStatusOptions } }
69
+ }))),
37
70
  /** Owned agent instructions (created at the plugin layer; parented by `SetParent`). */
38
71
  instructions: Schema.optional(Ref.Ref(Instructions).pipe(Annotation.SetParent.set(), Annotation.FormInlineAnnotation.set(true))),
39
72
  /** Artifacts (documents, outliners, tables, ...), in order. */
@@ -42,24 +75,13 @@ var Project = class extends Type.makeObject(DXN.make("org.dxos.type.project", "0
42
75
  routines: Schema.Array(Ref.Ref(Routine)).pipe(Annotation.SetParent.set(), Annotation.FormInputAnnotation.set(false)),
43
76
  /** Ad hoc markdown checklist — the scratch surface; project chats write into it. */
44
77
  outline: Schema.optional(Ref.Ref(Outline.Outline).pipe(Annotation.SetParent.set())),
45
- /** Owned (or adopted synced) task container, holding the project's tasks and milestones. */
46
- taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet).pipe(Annotation.SetParent.set())),
47
- /**
48
- * Source repository this project's work lands in. Independent of `taskSet`: a project that
49
- * mirrors a repository adopts its synced task set AND names it here, while a project whose
50
- * tasks are local can still reference the repository its issues are filed against.
51
- */
52
- repo: Schema.optional(Ref.Ref(Repo.Repo).annotate({ title: "Repository" })),
53
78
  /**
54
- * Repositories the project's coding agents work on. A cloud session checks each one out in its
55
- * sandbox; a session on this computer works in the folder chosen for the project there.
79
+ * Owned specs, in order: the normative text the project's tasks deliver. A form creates each and edits it inline.
80
+ * Suspended because Spec refers back.
56
81
  */
57
- repositories: Schema.optional(Schema.Array(Ref.Ref(Repo.Repo)).annotate({
58
- title: "Repositories",
59
- description: "Checked out for coding agents that run in the cloud."
60
- })),
61
- /** The default configuration (model, ...) for the sessions this project starts; a chat's own overrides it. */
62
- session: Schema.optional(SessionConfig.SessionConfig.pipe(Annotation.FormInputAnnotation.set(false)))
82
+ specs: Schema.Array(Schema.suspend(() => Ref.Ref(Spec))).pipe(Annotation.SetParent.set(), Annotation.FormCreateAnnotation.set(Type.getTypename(Spec))),
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()))
63
85
  }).pipe(Schema.annotate({ title: "Project" }), Annotation.LabelAnnotation.set(["name"]), Annotation.IconAnnotation.set({
64
86
  icon: "ph--stack--regular",
65
87
  hue: "amber"
@@ -75,7 +97,8 @@ var make = (props = {}) => {
75
97
  const project = Obj.make(Project, {
76
98
  ...props,
77
99
  artifacts: props.artifacts ?? [],
78
- routines: []
100
+ routines: [],
101
+ specs: props.specs ?? []
79
102
  });
80
103
  if (!props.taskSet) {
81
104
  const taskSet = TaskSet.make();
@@ -92,6 +115,11 @@ var make = (props = {}) => {
92
115
  return project;
93
116
  };
94
117
  /** Adds a routine to the project as an owned child; `SetParent` on the field cascades it. */
118
+ /** The project that owns the spec: its ECHO parent; undefined for a spec no project owns. */
119
+ var getOwner = (spec) => {
120
+ const parent = Obj.getParent(spec);
121
+ return Obj.instanceOf(Project, parent) ? parent : void 0;
122
+ };
95
123
  var addRoutine = (project, routine) => {
96
124
  Obj.update(project, (project) => {
97
125
  project.routines.push(Ref.make(routine));
@@ -121,6 +149,6 @@ var contextBindings = (project) => {
121
149
  };
122
150
  };
123
151
  //#endregion
124
- export { contextBindings as a, addRoutine as i, ProjectStatus as n, make as o, Project_exports as r, Project as t };
152
+ export { addRoutine as a, make as c, Project_exports as i, ProjectStatus as n, contextBindings as o, ProjectStatusOptions as r, getOwner as s, Project as t };
125
153
 
126
154
  //# sourceMappingURL=chunk-Project.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-Project.mjs","names":["Instructions.Instructions","Routine.Routine"],"sources":["../../src/types/Project.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { SessionConfig } from '@dxos/ai';\nimport { Annotation, DXN, Format, Obj, Ref, Type } from '@dxos/echo';\nimport { ArchivableAnnotation } from '@dxos/schema';\nimport { Outline, Repo, TaskSet } from '@dxos/types';\n\nimport * as Instructions from './Instructions.ts';\nimport * as Routine from './Routine.ts';\nimport * as Skill from './Skill.ts';\n\n/** Work-stream lifecycle state; what done means lives on the task set's milestones. */\nexport const ProjectStatus = Schema.Literals(['active', 'paused', 'blocked', 'ended']);\nexport type ProjectStatus = Schema.Schema.Type<typeof ProjectStatus>;\n\n/**\n * A user-facing container for interactive, long-running work: instructions (skills + commands),\n * artifacts, tasks, and AI chat sessions in project context. Successor to `Topic`.\n *\n * Fields are the refs the project owns and orders; everything that merely accumulates around it is\n * a query — chats by the ECHO parent edge, agents via chats.\n */\nexport class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.project', '0.6.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Format.Text),\n\n /** Work-stream lifecycle state. */\n status: Schema.optional(ProjectStatus),\n\n /** Owned agent instructions (created at the plugin layer; parented by `SetParent`). */\n instructions: Schema.optional(\n Ref.Ref(Instructions.Instructions).pipe(Annotation.SetParent.set(), Annotation.FormInlineAnnotation.set(true)),\n ),\n\n /** Artifacts (documents, outliners, tables, ...), in order. */\n artifacts: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(\n Annotation.SetParent.set({ override: false }),\n Annotation.FormInputAnnotation.set(false),\n ),\n\n /** Routines the project owns, in order, parented so they cascade-delete with it. */\n routines: Schema.Array(Ref.Ref(Routine.Routine)).pipe(\n Annotation.SetParent.set(),\n Annotation.FormInputAnnotation.set(false),\n ),\n\n /** Ad hoc markdown checklist — the scratch surface; project chats write into it. */\n outline: Schema.optional(Ref.Ref(Outline.Outline).pipe(Annotation.SetParent.set())),\n\n /** Owned (or adopted synced) task container, holding the project's tasks and milestones. */\n taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet).pipe(Annotation.SetParent.set())),\n\n /**\n * Source repository this project's work lands in. Independent of `taskSet`: a project that\n * mirrors a repository adopts its synced task set AND names it here, while a project whose\n * tasks are local can still reference the repository its issues are filed against.\n */\n // TODO(burdon): Change to array? Move into taskSet?\n repo: Schema.optional(Ref.Ref(Repo.Repo).annotate({ title: 'Repository' })),\n\n /**\n * Repositories the project's coding agents work on. A cloud session checks each one out in its\n * sandbox; a session on this computer works in the folder chosen for the project there.\n */\n repositories: Schema.optional(\n Schema.Array(Ref.Ref(Repo.Repo)).annotate({\n title: 'Repositories',\n description: 'Checked out for coding agents that run in the cloud.',\n }),\n ),\n\n /** The default configuration (model, ...) for the sessions this project starts; a chat's own overrides it. */\n session: Schema.optional(SessionConfig.SessionConfig.pipe(Annotation.FormInputAnnotation.set(false))),\n }).pipe(\n Schema.annotate({ title: 'Project' }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--stack--regular', hue: 'amber' }),\n ArchivableAnnotation.set(true),\n // Only the project skill: filing created objects into `artifacts` is what a project-scoped\n // session structurally needs; artifact-type skills are enabled on demand. Plain dotted key, so\n // the type does not depend on the plugin that owns the skill.\n Skill.SkillsAnnotation.set(['org.dxos.skill.project']),\n Annotation.UserType.set(),\n ),\n) {}\n\n/**\n * Factory wrapper around `Obj.make` for {@link Project}.\n *\n * Materializes the owned task set and scratch outline unless the caller supplies them: there is no UI\n * to add either to a project that lacks one, so a project without them has nowhere to put its tasks\n * and nothing to draft in. The parent edges follow from the fields' `SetParent` annotation.\n */\nexport const make = (\n props: Omit<Partial<Obj.MakeProps<typeof Project>>, 'artifacts' | 'routines'> & {\n artifacts?: ReadonlyArray<Ref.Ref<Obj.Unknown>>;\n } = {},\n): Project => {\n const project = Obj.make(Project, { ...props, artifacts: props.artifacts ?? [], routines: [] });\n if (!props.taskSet) {\n const taskSet = TaskSet.make();\n Obj.update(project, (project) => {\n project.taskSet = Ref.make(taskSet);\n });\n }\n if (!props.outline) {\n const outline = Outline.make({ name: props.name });\n Obj.update(project, (project) => {\n project.outline = Ref.make(outline);\n });\n }\n return project;\n};\n\n/** Adds a routine to the project as an owned child; `SetParent` on the field cascades it. */\nexport const addRoutine = (project: Project, routine: Routine.Routine): void => {\n Obj.update(project, (project) => {\n project.routines.push(Ref.make(routine));\n });\n};\n\n/** Bindings a chat session should receive when running in a project's context. */\nexport type ContextBindings = {\n skills: Ref.Ref<Skill.Skill>[];\n objects: Ref.Ref<Obj.Unknown>[];\n};\n\n/**\n * Bindings a chat session should receive when running in this project's context: the instructions'\n * skills and context objects. The instructions object itself is NOT bound — its text/commands reach\n * the system prompt through the chat's `instructions` ref, and a bound Instructions object would\n * render as an inert context stub. Requires the instructions ref to be resolved (`.target`);\n * unresolved refs contribute nothing.\n */\nexport const contextBindings = (project: Project): ContextBindings => {\n const instructionsRef = project.instructions;\n // `.target` throws when the ref has neither an inlined target nor a resolver attached\n // (e.g. an unresolved ref outside a database context); guard with `isAvailable` first.\n if (!instructionsRef?.isAvailable) {\n return { skills: [], objects: [] };\n }\n\n const instructions = instructionsRef.target;\n if (!instructions) {\n return { skills: [], objects: [] };\n }\n\n // Refs are kept as-is (never re-wrapped via `Ref.make`): bindings persist to the conversation feed,\n // and re-wrapping would drop the registry DXN of skills that have no space-DB identity.\n return {\n skills: [...instructions.skills],\n objects: [...(instructions.objects ?? [])],\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,gBAAgB,OAAO,SAAS;CAAC;CAAU;CAAU;CAAW;AAAO,CAAC;;;;;;;;AAUrF,IAAa,UAAb,cAA6B,KAAK,WAAoB,IAAI,KAAK,yBAAyB,OAAO,CAAC,CAAC,CAC/F,OAAO,OAAO;CACZ,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC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ACrD,WAAW,SAAS,IAAI,CAC1B,CACF,CAAC,CAAC,CAAC;;;;;;;;AASH,IAAa,QACX,QAEI,CAAC,MACO;CACZ,MAAM,UAAU,IAAI,KAAK,SAAS;EAAE,GAAG;EAAO,WAAW,MAAM,aAAa,CAAC;EAAG,UAAU,CAAC;CAAE,CAAC;CAC9F,IAAI,CAAC,MAAM,SAAS;EAClB,MAAM,UAAU,QAAQ,KAAK;EAC7B,IAAI,OAAO,UAAU,YAAY;GAC/B,QAAQ,UAAU,IAAI,KAAK,OAAO;EACpC,CAAC;CACH;CACA,IAAI,CAAC,MAAM,SAAS;EAClB,MAAM,UAAU,QAAQ,KAAK,EAAE,MAAM,MAAM,KAAK,CAAC;EACjD,IAAI,OAAO,UAAU,YAAY;GAC/B,QAAQ,UAAU,IAAI,KAAK,OAAO;EACpC,CAAC;CACH;CACA,OAAO;AACT;;AAGA,IAAa,cAAc,SAAkB,YAAmC;CAC9E,IAAI,OAAO,UAAU,YAAY;EAC/B,QAAQ,SAAS,KAAK,IAAI,KAAK,OAAO,CAAC;CACzC,CAAC;AACH;;;;;;;;AAeA,IAAa,mBAAmB,YAAsC;CACpE,MAAM,kBAAkB,QAAQ;CAGhC,IAAI,CAAC,iBAAiB,aACpB,OAAO;EAAE,QAAQ,CAAC;EAAG,SAAS,CAAC;CAAE;CAGnC,MAAM,eAAe,gBAAgB;CACrC,IAAI,CAAC,cACH,OAAO;EAAE,QAAQ,CAAC;EAAG,SAAS,CAAC;CAAE;CAKnC,OAAO;EACL,QAAQ,CAAC,GAAG,aAAa,MAAM;EAC/B,SAAS,CAAC,GAAI,aAAa,WAAW,CAAC,CAAE;CAC3C;AACF"}
1
+ {"version":3,"file":"chunk-Project.mjs","names":["Instructions.Instructions","Routine.Routine","Spec.Spec"],"sources":["../../src/types/Project.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Format, Obj, Ref, Type } from '@dxos/echo';\nimport { PropertyMetaAnnotationId } from '@dxos/echo/internal';\nimport { ArchivableAnnotation } from '@dxos/schema';\nimport { Outline, type Task, TaskSet } from '@dxos/types';\n\nimport * as Instructions from './Instructions.ts';\nimport * as Routine from './Routine.ts';\nimport * as Skill from './Skill.ts';\nimport * as Spec from './Spec.ts';\n\n/** Work-stream lifecycle state; what done means lives on the task set's milestones. */\nexport const ProjectStatus = Schema.Literals(['active', 'paused', 'blocked', 'ended']);\nexport type ProjectStatus = Schema.Schema.Type<typeof ProjectStatus>;\n\nexport const ProjectStatusOptions: Task.Option<ProjectStatus>[] = [\n { id: 'active', title: 'Active', color: 'green', icon: 'ph--play-circle--regular' },\n { id: 'paused', title: 'Paused', color: 'amber', icon: 'ph--pause-circle--regular' },\n { id: 'blocked', title: 'Blocked', color: 'rose', icon: 'ph--prohibit--regular' },\n { id: 'ended', title: 'Ended', color: 'neutral', icon: 'ph--check-circle--regular' },\n];\n\n/**\n * A user-facing container for interactive, long-running work: instructions (skills + commands),\n * artifacts, tasks, and AI chat sessions in project context. Successor to `Topic`.\n *\n * Fields are the refs the project owns and orders; everything that merely accumulates around it is\n * a query — chats by the ECHO parent edge, agents via chats. What only some projects need, such as the\n * repositories coding agents work on, is an annotation the plugin that needs it adds.\n */\nexport class Project extends Type.makeObject<Project>(DXN.make('org.dxos.type.project', '0.8.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Format.Text),\n\n /** Work-stream lifecycle state. */\n status: Schema.optional(\n ProjectStatus.pipe(\n Format.FormatAnnotation.set(Format.TypeFormat.SingleSelect),\n Schema.annotate({\n title: 'Status',\n [PropertyMetaAnnotationId]: { singleSelect: { options: ProjectStatusOptions } },\n }),\n ),\n ),\n\n /** Owned agent instructions (created at the plugin layer; parented by `SetParent`). */\n instructions: Schema.optional(\n Ref.Ref(Instructions.Instructions).pipe(Annotation.SetParent.set(), Annotation.FormInlineAnnotation.set(true)),\n ),\n\n /** Artifacts (documents, outliners, tables, ...), in order. */\n artifacts: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(\n Annotation.SetParent.set({ override: false }),\n Annotation.FormInputAnnotation.set(false),\n ),\n\n /** Routines the project owns, in order, parented so they cascade-delete with it. */\n routines: Schema.Array(Ref.Ref(Routine.Routine)).pipe(\n Annotation.SetParent.set(),\n Annotation.FormInputAnnotation.set(false),\n ),\n\n /** Ad hoc markdown checklist — the scratch surface; project chats write into it. */\n outline: Schema.optional(Ref.Ref(Outline.Outline).pipe(Annotation.SetParent.set())),\n\n /**\n * Owned specs, in order: the normative text the project's tasks deliver. A form creates each and edits it inline.\n * Suspended because Spec refers back.\n */\n specs: Schema.Array(Schema.suspend((): Ref.RefSchema<Spec.Spec> => Ref.Ref(Spec.Spec))).pipe(\n Annotation.SetParent.set(),\n Annotation.FormCreateAnnotation.set(Type.getTypename(Spec.Spec)),\n ),\n\n /** Owned (or adopted synced) task container, holding the project's tasks and milestones. */\n taskSet: Schema.optional(Ref.Ref(TaskSet.TaskSet).pipe(Annotation.SetParent.set())),\n }).pipe(\n Schema.annotate({ title: 'Project' }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--stack--regular', hue: 'amber' }),\n ArchivableAnnotation.set(true),\n // Only the project skill: filing created objects into `artifacts` is what a project-scoped\n // session structurally needs; artifact-type skills are enabled on demand. Plain dotted key, so\n // the type does not depend on the plugin that owns the skill.\n Skill.SkillsAnnotation.set(['org.dxos.skill.project']),\n Annotation.UserType.set(),\n ),\n) {}\n\n/**\n * Factory wrapper around `Obj.make` for {@link Project}.\n *\n * Materializes the owned task set and scratch outline unless the caller supplies them: there is no UI\n * to add either to a project that lacks one, so a project without them has nowhere to put its tasks\n * and nothing to draft in. The parent edges follow from the fields' `SetParent` annotation.\n */\nexport const make = (\n props: Omit<Partial<Obj.MakeProps<typeof Project>>, 'artifacts' | 'routines' | 'specs'> & {\n artifacts?: ReadonlyArray<Ref.Ref<Obj.Unknown>>;\n specs?: ReadonlyArray<Ref.Ref<Spec.Spec>>;\n } = {},\n): Project => {\n const project = Obj.make(Project, {\n ...props,\n artifacts: props.artifacts ?? [],\n routines: [],\n specs: props.specs ?? [],\n });\n if (!props.taskSet) {\n const taskSet = TaskSet.make();\n Obj.update(project, (project) => {\n project.taskSet = Ref.make(taskSet);\n });\n }\n if (!props.outline) {\n const outline = Outline.make({ name: props.name });\n Obj.update(project, (project) => {\n project.outline = Ref.make(outline);\n });\n }\n return project;\n};\n\n/** Adds a routine to the project as an owned child; `SetParent` on the field cascades it. */\n/** The project that owns the spec: its ECHO parent; undefined for a spec no project owns. */\nexport const getOwner = (spec: Spec.Spec): Project | undefined => {\n const parent = Obj.getParent(spec);\n return Obj.instanceOf(Project, parent) ? parent : undefined;\n};\n\nexport const addRoutine = (project: Project, routine: Routine.Routine): void => {\n Obj.update(project, (project) => {\n project.routines.push(Ref.make(routine));\n });\n};\n\n/** Bindings a chat session should receive when running in a project's context. */\nexport type ContextBindings = {\n skills: Ref.Ref<Skill.Skill>[];\n objects: Ref.Ref<Obj.Unknown>[];\n};\n\n/**\n * Bindings a chat session should receive when running in this project's context: the instructions'\n * skills and context objects. The instructions object itself is NOT bound — its text/commands reach\n * the system prompt through the chat's `instructions` ref, and a bound Instructions object would\n * render as an inert context stub. Requires the instructions ref to be resolved (`.target`);\n * unresolved refs contribute nothing.\n */\nexport const contextBindings = (project: Project): ContextBindings => {\n const instructionsRef = project.instructions;\n // `.target` throws when the ref has neither an inlined target nor a resolver attached\n // (e.g. an unresolved ref outside a database context); guard with `isAvailable` first.\n if (!instructionsRef?.isAvailable) {\n return { skills: [], objects: [] };\n }\n\n const instructions = instructionsRef.target;\n if (!instructions) {\n return { skills: [], objects: [] };\n }\n\n // Refs are kept as-is (never re-wrapped via `Ref.make`): bindings persist to the conversation feed,\n // and re-wrapping would drop the registry DXN of skills that have no space-DB identity.\n return {\n skills: [...instructions.skills],\n objects: [...(instructions.objects ?? [])],\n };\n};\n"],"mappings":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