@tianshu-ai/tianshu 0.4.2 → 0.4.4

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 (77) hide show
  1. package/node_modules/@tianshu-ai/plugin-sdk/dist/capabilities.d.ts +4 -0
  2. package/node_modules/@tianshu-ai/plugin-sdk/dist/capabilities.d.ts.map +1 -1
  3. package/node_modules/@tianshu-ai/plugin-sdk/dist/capabilities.js +4 -0
  4. package/node_modules/@tianshu-ai/plugin-sdk/dist/capabilities.js.map +1 -1
  5. package/node_modules/@tianshu-ai/plugin-sdk/dist/index.d.ts +1 -0
  6. package/node_modules/@tianshu-ai/plugin-sdk/dist/index.d.ts.map +1 -1
  7. package/node_modules/@tianshu-ai/plugin-sdk/dist/index.js +1 -0
  8. package/node_modules/@tianshu-ai/plugin-sdk/dist/index.js.map +1 -1
  9. package/node_modules/@tianshu-ai/plugin-sdk/dist/solution.d.ts +322 -0
  10. package/node_modules/@tianshu-ai/plugin-sdk/dist/solution.d.ts.map +1 -0
  11. package/node_modules/@tianshu-ai/plugin-sdk/dist/solution.js +16 -0
  12. package/node_modules/@tianshu-ai/plugin-sdk/dist/solution.js.map +1 -0
  13. package/node_modules/@tianshu-ai/plugin-sdk/dist/workforce-snapshot.d.ts +62 -4
  14. package/node_modules/@tianshu-ai/plugin-sdk/dist/workforce-snapshot.d.ts.map +1 -1
  15. package/node_modules/@tianshu-ai/plugin-sdk/src/capabilities.ts +5 -0
  16. package/node_modules/@tianshu-ai/plugin-sdk/src/index.ts +1 -0
  17. package/node_modules/@tianshu-ai/plugin-sdk/src/solution.ts +356 -0
  18. package/node_modules/@tianshu-ai/plugin-sdk/src/workforce-snapshot.ts +75 -4
  19. package/package.json +1 -1
  20. package/packages/plugin-sdk/dist/capabilities.d.ts +4 -0
  21. package/packages/plugin-sdk/dist/capabilities.d.ts.map +1 -1
  22. package/packages/plugin-sdk/dist/capabilities.js +4 -0
  23. package/packages/plugin-sdk/dist/capabilities.js.map +1 -1
  24. package/packages/plugin-sdk/dist/index.d.ts +1 -0
  25. package/packages/plugin-sdk/dist/index.d.ts.map +1 -1
  26. package/packages/plugin-sdk/dist/index.js +1 -0
  27. package/packages/plugin-sdk/dist/index.js.map +1 -1
  28. package/packages/plugin-sdk/dist/solution.d.ts +322 -0
  29. package/packages/plugin-sdk/dist/solution.d.ts.map +1 -0
  30. package/packages/plugin-sdk/dist/solution.js +16 -0
  31. package/packages/plugin-sdk/dist/solution.js.map +1 -0
  32. package/packages/plugin-sdk/dist/workforce-snapshot.d.ts +62 -4
  33. package/packages/plugin-sdk/dist/workforce-snapshot.d.ts.map +1 -1
  34. package/packages/server/builtinConfig/plugins/workforce-studio/manifest.json +8 -1
  35. package/packages/server/dist/chat/handler.d.ts.map +1 -1
  36. package/packages/server/dist/chat/handler.js +28 -2
  37. package/packages/server/dist/chat/handler.js.map +1 -1
  38. package/packages/server/dist/chat/system-prompt.d.ts +38 -1
  39. package/packages/server/dist/chat/system-prompt.d.ts.map +1 -1
  40. package/packages/server/dist/chat/system-prompt.js +26 -6
  41. package/packages/server/dist/chat/system-prompt.js.map +1 -1
  42. package/packages/server/dist/core/main-agent-config.d.ts +47 -0
  43. package/packages/server/dist/core/main-agent-config.d.ts.map +1 -0
  44. package/packages/server/dist/core/main-agent-config.js +83 -0
  45. package/packages/server/dist/core/main-agent-config.js.map +1 -0
  46. package/packages/server/dist/core/paths.d.ts +12 -0
  47. package/packages/server/dist/core/paths.d.ts.map +1 -1
  48. package/packages/server/dist/core/paths.js +16 -0
  49. package/packages/server/dist/core/paths.js.map +1 -1
  50. package/packages/server/dist/index.js +20 -0
  51. package/packages/server/dist/index.js.map +1 -1
  52. package/packages/server/dist/plugins-routes.d.ts +3 -3
  53. package/packages/server/dist/workforce/snapshot.d.ts +0 -16
  54. package/packages/server/dist/workforce/snapshot.d.ts.map +1 -1
  55. package/packages/server/dist/workforce/snapshot.js +266 -64
  56. package/packages/server/dist/workforce/snapshot.js.map +1 -1
  57. package/packages/server/dist/workforce/solutions.d.ts +34 -0
  58. package/packages/server/dist/workforce/solutions.d.ts.map +1 -0
  59. package/packages/server/dist/workforce/solutions.js +755 -0
  60. package/packages/server/dist/workforce/solutions.js.map +1 -0
  61. package/packages/web/dist/assets/{bundle-web-4cjT-3Gc.js → bundle-web-CIlrIXz-.js} +1 -1
  62. package/packages/web/dist/assets/index-CTNJpjRK.js +71 -0
  63. package/packages/web/dist/assets/index-CTckG6X5.css +2 -0
  64. package/packages/web/dist/index.html +2 -2
  65. package/plugins/workforce-studio/dist/client.d.ts.map +1 -1
  66. package/plugins/workforce-studio/dist/client.js +82 -5
  67. package/plugins/workforce-studio/dist/client.js.map +1 -1
  68. package/plugins/workforce-studio/dist/server.d.ts.map +1 -1
  69. package/plugins/workforce-studio/dist/server.js +137 -0
  70. package/plugins/workforce-studio/dist/server.js.map +1 -1
  71. package/plugins/workforce-studio/dist/solution-view.d.ts +3 -0
  72. package/plugins/workforce-studio/dist/solution-view.d.ts.map +1 -0
  73. package/plugins/workforce-studio/dist/solution-view.js +495 -0
  74. package/plugins/workforce-studio/dist/solution-view.js.map +1 -0
  75. package/plugins/workforce-studio/manifest.json +8 -1
  76. package/packages/web/dist/assets/index-5Pcda8Ig.js +0 -71
  77. package/packages/web/dist/assets/index-fnzabO1H.css +0 -2
@@ -47,6 +47,10 @@ export declare const KNOWN_CAPABILITIES: {
47
47
  readonly exclusive: true;
48
48
  readonly description: "Build a read-only snapshot of the tenant's agent configuration (main agent prompt + tools + skills, every worker agent's prompt + allowed tools + allowed skills). Used by the Workforce Studio plugin to render an inspect-and-export UI; the snapshot includes full skill markdown bodies so the studio can ship a faithful bundle.";
49
49
  };
50
+ readonly "host.solutions": {
51
+ readonly exclusive: true;
52
+ readonly description: "Manage Solutions (ADR-0008): declarative descriptions of the desired agent configuration for a tenant. Extract current reality into a named solution, list / read / save / delete solutions, and diff a solution against reality or another solution. Phase 2 has no Apply — solutions are inert files on disk until a later phase reconciles them into reality.";
53
+ };
50
54
  };
51
55
  export type CapabilityName = keyof typeof KNOWN_CAPABILITIES;
52
56
  /** True iff the given string is a registered capability name. */
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDoB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE7D,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,cAAc,CAE/D;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEvE"}
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DoB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE7D,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,cAAc,CAE/D;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEvE"}
@@ -57,6 +57,10 @@ export const KNOWN_CAPABILITIES = {
57
57
  exclusive: true,
58
58
  description: "Build a read-only snapshot of the tenant's agent configuration (main agent prompt + tools + skills, every worker agent's prompt + allowed tools + allowed skills). Used by the Workforce Studio plugin to render an inspect-and-export UI; the snapshot includes full skill markdown bodies so the studio can ship a faithful bundle.",
59
59
  },
60
+ "host.solutions": {
61
+ exclusive: true,
62
+ description: "Manage Solutions (ADR-0008): declarative descriptions of the desired agent configuration for a tenant. Extract current reality into a named solution, list / read / save / delete solutions, and diff a solution against reality or another solution. Phase 2 has no Apply — solutions are inert files on disk until a later phase reconciles them into reality.",
63
+ },
60
64
  };
61
65
  /** True iff the given string is a registered capability name. */
62
66
  export function isCapabilityName(s) {
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,iEAAiE;AACjE,iEAAiE;AACjE,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAC1D,EAAE;AACF,mBAAmB;AACnB,kEAAkE;AAClE,+DAA+D;AAC/D,mCAAmC;AACnC,kEAAkE;AAClE,2DAA2D;AAO3D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,eAAe,EAAE;QACf,SAAS,EAAE,IAAI;QACf,WAAW,EACT,8EAA8E;KACjF;IACD,kBAAkB,EAAE;QAClB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,0SAA0S;KAC7S;IACD,aAAa,EAAE;QACb,SAAS,EAAE,IAAI;QACf,WAAW,EACT,0HAA0H;KAC7H;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uTAAuT;KAC1T;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,sWAAsW;KACzW;IACD,kBAAkB,EAAE;QAClB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,qTAAqT;KACxT;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,oNAAoN;KACvN;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,sRAAsR;KACzR;IACD,UAAU,EAAE;QACV,SAAS,EAAE,IAAI;QACf,WAAW,EACT,iXAAiX;KACpX;IACD,sBAAsB,EAAE;QACtB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uTAAuT;KAC1T;IACD,wBAAwB,EAAE;QACxB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uUAAuU;KAC1U;CACgD,CAAC;AAIpD,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,iEAAiE;AACjE,iEAAiE;AACjE,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAC1D,EAAE;AACF,mBAAmB;AACnB,kEAAkE;AAClE,+DAA+D;AAC/D,mCAAmC;AACnC,kEAAkE;AAClE,2DAA2D;AAO3D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,eAAe,EAAE;QACf,SAAS,EAAE,IAAI;QACf,WAAW,EACT,8EAA8E;KACjF;IACD,kBAAkB,EAAE;QAClB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,0SAA0S;KAC7S;IACD,aAAa,EAAE;QACb,SAAS,EAAE,IAAI;QACf,WAAW,EACT,0HAA0H;KAC7H;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uTAAuT;KAC1T;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,sWAAsW;KACzW;IACD,kBAAkB,EAAE;QAClB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,qTAAqT;KACxT;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,oNAAoN;KACvN;IACD,mBAAmB,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,sRAAsR;KACzR;IACD,UAAU,EAAE;QACV,SAAS,EAAE,IAAI;QACf,WAAW,EACT,iXAAiX;KACpX;IACD,sBAAsB,EAAE;QACtB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uTAAuT;KAC1T;IACD,wBAAwB,EAAE;QACxB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,uUAAuU;KAC1U;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,IAAI;QACf,WAAW,EACT,kWAAkW;KACrW;CACgD,CAAC;AAIpD,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
@@ -7,5 +7,6 @@ export * from "./catalog.js";
7
7
  export * from "./lsp.js";
8
8
  export * from "./channel-bindings.js";
9
9
  export * from "./workforce-snapshot.js";
10
+ export * from "./solution.js";
10
11
  export { McpToolset, textOfMcpContent, type McpEndpointResolver, type McpToolDescriptor, type McpToolFilter, type McpToolsetEntry, type McpToolsetOptions, type McpToolsetSnapshot, type ToolsetProvider, } from "./mcp-toolset.js";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC"}
@@ -17,5 +17,6 @@ export * from "./catalog.js";
17
17
  export * from "./lsp.js";
18
18
  export * from "./channel-bindings.js";
19
19
  export * from "./workforce-snapshot.js";
20
+ export * from "./solution.js";
20
21
  export { McpToolset, textOfMcpContent, } from "./mcp-toolset.js";
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,qEAAqE;AACrE,iCAAiC;AACjC,EAAE;AACF,wEAAwE;AACxE,iEAAiE;AACjE,0BAA0B;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,UAAU,EACV,gBAAgB,GAQjB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,qEAAqE;AACrE,iCAAiC;AACjC,EAAE;AACF,wEAAwE;AACxE,iEAAiE;AACjE,0BAA0B;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,gBAAgB,GAQjB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,322 @@
1
+ /** Provenance stamped onto a solution that was extracted from a
2
+ * live tenant snapshot rather than authored by hand. null for
3
+ * hand-authored solutions. */
4
+ export interface SolutionExtractedFrom {
5
+ tenantId: string;
6
+ tianshuVersion: string;
7
+ /** ms epoch of the extraction. */
8
+ extractedAt: number;
9
+ }
10
+ /** Plugin selection for a solution. Phase 2 stores it; Phase 4
11
+ * acts on it (enable/disable on Apply). */
12
+ export interface SolutionPlugins {
13
+ /** Explicit enable-list of plugin ids. On Apply (Phase 4) the
14
+ * reconciler enables exactly these and disables the rest. */
15
+ enabled: string[];
16
+ }
17
+ export interface SolutionMainAgent {
18
+ /** Relative path (within the solution dir) to a markdown
19
+ * override block injected into the main agent prompt, or null
20
+ * for no override. */
21
+ tenantPromptPath: string | null;
22
+ /** Skill allow-list by skill name. null = no restriction.
23
+ * Reserved for a future advanced "whitelist" mode; Phase 2's
24
+ * UI is deny-only and leaves this null. Plugin-contributed
25
+ * skills are always implicitly allowed regardless. */
26
+ skillsAllow: string[] | null;
27
+ /** Skill deny-list by skill name. The primary Phase-2 control:
28
+ * the operator excludes tenant-owned skills they don't want.
29
+ * Plugin-contributed skills can't be denied (they're locked). */
30
+ skillsDeny: string[];
31
+ /** Tool allow-list by tool name. null = no restriction.
32
+ * Reserved for the future whitelist mode like skillsAllow. */
33
+ toolsAllow: string[] | null;
34
+ /** Tool deny-list by tool name. Symmetric with skillsDeny. */
35
+ toolsDeny: string[];
36
+ /** Per-block overrides of host-generated prompt text. Each key
37
+ * maps to a relative sidecar path (main-agent/<key>.md) when
38
+ * set, or null to fall back to the host default. Only the
39
+ * blocks the host marks overridable appear here:
40
+ * - executionBias
41
+ * - replyStyle
42
+ * - userOnboarding
43
+ * Reserved for Phase 3 (Apply) — stored but not yet wired into
44
+ * the host renderer. */
45
+ overrides: SolutionPromptOverrides;
46
+ /** Operator-authored extra prompt fragments appended to the
47
+ * main-agent prompt. Each is free-form markdown the user added
48
+ * in the studio (not from a plugin). Phase 2 stores them;
49
+ * Phase 3 injects them. */
50
+ customFragments: SolutionCustomFragment[];
51
+ }
52
+ /** Override sidecar paths for host-generated blocks. null = use
53
+ * the host default. */
54
+ export interface SolutionPromptOverrides {
55
+ executionBias: string | null;
56
+ replyStyle: string | null;
57
+ userOnboarding: string | null;
58
+ }
59
+ /** A user-authored prompt fragment. id is a stable slug used for
60
+ * the sidecar filename (main-agent/fragments/<id>.md). */
61
+ export interface SolutionCustomFragment {
62
+ id: string;
63
+ title: string;
64
+ /** Relative sidecar path holding the fragment body. */
65
+ path: string;
66
+ }
67
+ /** The override keys the studio understands. Kept as a const-ish
68
+ * union so SDK consumers and the host agree on the set. */
69
+ export type SolutionOverrideKey = "executionBias" | "replyStyle" | "userOnboarding";
70
+ export interface SolutionWorker {
71
+ slug: string;
72
+ kind: string;
73
+ name: string;
74
+ description: string | null;
75
+ modelId: string | null;
76
+ enabled: boolean;
77
+ /** Relative path (within the solution dir) to the worker's
78
+ * SOUL.md, or null. */
79
+ systemPromptPath: string | null;
80
+ toolsAllow: string[] | null;
81
+ skillsAllow: string[] | null;
82
+ source: "builtin" | "user";
83
+ }
84
+ /** The on-disk `solution.json` shape (schema v1). */
85
+ export interface SolutionSpec {
86
+ /** Always "tianshu.solution.v1" for this version. */
87
+ schema: "tianshu.solution.v1";
88
+ slug: string;
89
+ name: string;
90
+ description: string;
91
+ createdAt: number;
92
+ updatedAt: number;
93
+ extractedFrom: SolutionExtractedFrom | null;
94
+ plugins: SolutionPlugins;
95
+ mainAgent: SolutionMainAgent;
96
+ workers: SolutionWorker[];
97
+ }
98
+ /** One main-agent prompt block as shown in the Solution view's
99
+ * block editor. Mirrors WorkforcePromptBlock from the snapshot,
100
+ * but adds the solution-editing semantics: read-only blocks
101
+ * (host / plugin sourced) are shown for context only; editable
102
+ * blocks (workspace context, tenant prompt override) carry a
103
+ * body the operator can change and we persist on save.
104
+ *
105
+ * We duplicate the shape rather than import WorkforcePromptBlock
106
+ * so the solution surface stays self-contained — a solution
107
+ * block's editability is a solution concept, not a snapshot one. */
108
+ export interface SolutionPromptBlock {
109
+ kind: string;
110
+ title: string;
111
+ /** "host" | "plugin:<id>" | "tenant" | "workspace". */
112
+ source: string;
113
+ /** Provenance bucket for the badge. */
114
+ origin: "core" | "builtin-plugin" | "tenant-plugin" | "host" | "tenant" | "workspace";
115
+ /** Whether the Solution editor lets the operator change this
116
+ * block. plugin blocks + pure code-generated blocks (brand,
117
+ * runtime context, available-skills) are false; tenant prompt,
118
+ * workspace files, and the overridable host blocks (execution
119
+ * bias, reply style, user onboarding) are true. */
120
+ editable: boolean;
121
+ /** Block body shown in the editor. For an overridable block
122
+ * this is the override value if set, else the host default. */
123
+ text: string;
124
+ /** The host-generated default text for an overridable block,
125
+ * shown as the reset target + the read-only reference. null
126
+ * for non-overridable blocks. */
127
+ defaultText?: string | null;
128
+ /** For overridable host blocks: the override key the studio
129
+ * uses to persist this block's override (executionBias /
130
+ * replyStyle / userOnboarding). Absent for tenant-prompt /
131
+ * workspace / custom-fragment blocks, which persist through
132
+ * their own dedicated fields. */
133
+ overrideKey?: SolutionOverrideKey;
134
+ /** True iff this block currently carries a solution override
135
+ * (text differs from / supersedes defaultText). */
136
+ overridden?: boolean;
137
+ /** For a user-authored custom fragment block: its stable id, so
138
+ * the UI can edit / remove it. Absent for all other blocks. */
139
+ customFragmentId?: string;
140
+ note?: string;
141
+ }
142
+ /** One selectable skill / tool in the Solution editor's picker.
143
+ * The operator excludes (deny) the tenant-owned ones they don't
144
+ * want; plugin-locked entries are shown but can't be toggled. */
145
+ export interface SolutionResourceOption {
146
+ name: string;
147
+ description: string;
148
+ /** Provenance bucket for the badge. */
149
+ origin: "core" | "builtin-plugin" | "tenant-plugin" | "host";
150
+ /** Concrete contributor id: the plugin id (`wechat`,
151
+ * `workboard`, …) for plugin-sourced entries, or "core" /
152
+ * "host" for host-owned ones. Surfaced so the picker can show
153
+ * exactly which plugin a skill / tool came from, not just the
154
+ * origin bucket. */
155
+ pluginId: string;
156
+ /** True iff the entry is contributed by a plugin / host and
157
+ * therefore can't be excluded — it's shown locked. tenant-
158
+ * owned entries are unlocked and can be denied. */
159
+ locked: boolean;
160
+ }
161
+ /** A solution as returned to the studio: the spec plus the
162
+ * resolved bodies of its sidecar files, so the UI can render
163
+ * prompt content without a second round-trip. */
164
+ export interface SolutionDetail {
165
+ spec: SolutionSpec;
166
+ /** Resolved tenant prompt override body (from tenantPromptPath),
167
+ * or null. */
168
+ tenantPrompt: string | null;
169
+ /** Resolved worker SOUL.md bodies, keyed by worker slug. */
170
+ workerPrompts: Record<string, string>;
171
+ /** Main-agent prompt blocks for the block-style editor. The
172
+ * read-only host / plugin blocks come from current reality as
173
+ * reference; the editable workspace / tenant-prompt blocks
174
+ * carry the solution's own values. */
175
+ mainBlocks: SolutionPromptBlock[];
176
+ /** Full skill catalogue from reality, for the deny picker.
177
+ * plugin/host-sourced entries are locked; tenant ones can be
178
+ * excluded. */
179
+ availableSkills: SolutionResourceOption[];
180
+ /** Full tool catalogue from reality, for the deny picker. */
181
+ availableTools: SolutionResourceOption[];
182
+ /** Per-worker editor views, keyed by worker slug. Each carries
183
+ * the worker's block decomposition (mirroring the agent-loop
184
+ * worker prompt) + its own skill / tool catalogue for the deny
185
+ * picker — the worker equivalent of mainBlocks +
186
+ * availableSkills/Tools. */
187
+ workerViews: Record<string, SolutionWorkerView>;
188
+ /** Every plugin discovered for the tenant, for the include /
189
+ * exclude picker. The solution's `plugins.enabled` decides
190
+ * which are ticked; this list is the full menu. */
191
+ availablePlugins: SolutionPluginOption[];
192
+ /** True for the reserved `current` slug — the studio renders it
193
+ * read-only (it's a live mirror of reality, regenerated on
194
+ * extract) and hides Apply. */
195
+ isCurrent: boolean;
196
+ }
197
+ /** Editor view data for one worker in the Solution view. */
198
+ export interface SolutionWorkerView {
199
+ blocks: SolutionPromptBlock[];
200
+ availableSkills: SolutionResourceOption[];
201
+ availableTools: SolutionResourceOption[];
202
+ }
203
+ /** One plugin in the solution's plugin include/exclude picker. */
204
+ export interface SolutionPluginOption {
205
+ id: string;
206
+ displayName: string;
207
+ description: string;
208
+ origin: "builtin-plugin" | "tenant-plugin";
209
+ /** Live state in reality — surfaced so the operator sees what's
210
+ * currently active vs failed, independent of the solution's
211
+ * own enable choice. */
212
+ state: "active" | "failed" | "disabled" | "loading";
213
+ }
214
+ /** Lightweight summary for the solution list / picker. */
215
+ export interface SolutionSummary {
216
+ slug: string;
217
+ name: string;
218
+ description: string;
219
+ updatedAt: number;
220
+ workerCount: number;
221
+ pluginCount: number;
222
+ /** Whether this is the reserved `current` mirror. */
223
+ isCurrent: boolean;
224
+ /** Provenance: "extracted" when extractedFrom is set,
225
+ * "authored" otherwise. */
226
+ kind: "extracted" | "authored";
227
+ }
228
+ /** One structural difference between two solutions, or between a
229
+ * solution and current reality. */
230
+ export interface SolutionDiffEntry {
231
+ /** Dot-path of the changed field, e.g. "mainAgent.skillsAllow"
232
+ * or "workers.researcher.modelId". */
233
+ path: string;
234
+ /** add = present in target, absent in base; remove = inverse;
235
+ * change = present in both but different. */
236
+ op: "add" | "remove" | "change";
237
+ /** Human-readable before / after, JSON-stringified for
238
+ * scalars and arrays. */
239
+ before: string | null;
240
+ after: string | null;
241
+ }
242
+ export interface SolutionDiff {
243
+ /** What we compared against. */
244
+ baseLabel: string;
245
+ targetLabel: string;
246
+ entries: SolutionDiffEntry[];
247
+ }
248
+ /** Capability surface the studio plugin uses to manage solutions.
249
+ * Registered host-side as `host.solutions`. All methods are
250
+ * scoped to the calling tenant; userId is passed where per-user
251
+ * context (extraction) matters. */
252
+ export interface SolutionsCapability {
253
+ /** List every solution (including the reserved `current`). */
254
+ list(userId: string): SolutionSummary[];
255
+ /** Read one solution with resolved sidecar bodies. Returns null
256
+ * when the slug doesn't exist (other than `current`, which is
257
+ * always materialised on read). */
258
+ get(userId: string, slug: string): SolutionDetail | null;
259
+ /** Extract current reality into a named solution. When slug is
260
+ * omitted or "current", refreshes the live mirror. Overwrites
261
+ * an existing slug (the route layer asks for confirmation). */
262
+ extract(userId: string, args: {
263
+ slug: string;
264
+ name?: string;
265
+ description?: string;
266
+ }): SolutionDetail;
267
+ /** Persist edits to an existing solution. Rejects the reserved
268
+ * `current` slug. Returns the saved detail. */
269
+ save(userId: string, detail: SolutionSpecInput): SolutionDetail;
270
+ /** Delete a solution. Rejects `current`. No-op when absent. */
271
+ remove(userId: string, slug: string): void;
272
+ /** Diff a solution against current reality (target="reality")
273
+ * or against another solution slug. */
274
+ diff(userId: string, args: {
275
+ slug: string;
276
+ against: string;
277
+ }): SolutionDiff;
278
+ /** Apply a solution to reality (ADR-0008 Phase 3). Writes the
279
+ * main-agent config + worker files back into the tenant so the
280
+ * live chat path picks them up. Non-destructive subset — does
281
+ * not touch plugin enable/disable. Rejects the `current`
282
+ * mirror. */
283
+ apply(userId: string, slug: string): {
284
+ ok: true;
285
+ appliedWorkers: string[];
286
+ };
287
+ }
288
+ /** Input shape for save(): the spec plus inline prompt bodies the
289
+ * host writes out to sidecar files. We accept inline strings (not
290
+ * paths) on the write path so the UI doesn't have to manage file
291
+ * layout; the host decides where bodies live. */
292
+ export interface SolutionSpecInput {
293
+ slug: string;
294
+ name: string;
295
+ description: string;
296
+ plugins: SolutionPlugins;
297
+ mainAgent: Omit<SolutionMainAgent, "tenantPromptPath" | "overrides" | "customFragments"> & {
298
+ /** Inline body; host writes to main-agent/prompt.md. Empty /
299
+ * null clears the override. */
300
+ tenantPrompt: string | null;
301
+ /** Inline override bodies for the host blocks. null / empty
302
+ * clears that override (falls back to host default). */
303
+ overrides: {
304
+ executionBias: string | null;
305
+ replyStyle: string | null;
306
+ userOnboarding: string | null;
307
+ };
308
+ /** Inline custom fragments. id stable across saves; empty
309
+ * body drops the fragment. */
310
+ customFragments: Array<{
311
+ id: string;
312
+ title: string;
313
+ body: string;
314
+ }>;
315
+ };
316
+ workers: Array<Omit<SolutionWorker, "systemPromptPath"> & {
317
+ /** Inline SOUL.md body; host writes to
318
+ * workers/<slug>/SOUL.md. */
319
+ systemPrompt: string | null;
320
+ }>;
321
+ }
322
+ //# sourceMappingURL=solution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solution.d.ts","sourceRoot":"","sources":["../src/solution.ts"],"names":[],"mappings":"AAeA;;+BAE+B;AAC/B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,M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AC;KAC7B,CACF,CAAC;CACH"}
@@ -0,0 +1,16 @@
1
+ // Solution model (ADR-0008) — declarative description of "what the
2
+ // operator wants the agent system to look like" for a tenant.
3
+ //
4
+ // A Solution is distinct from current reality (the
5
+ // WorkforceSnapshot): reality is observation, a solution is intent.
6
+ // Phase 2 (this file's first consumer) implements extract / save /
7
+ // list / edit / diff — no Apply yet, so a solution on disk has no
8
+ // runtime effect.
9
+ //
10
+ // Storage (per ADR-0008 §2):
11
+ // <home>/_tenant/solutions/<slug>/
12
+ // solution.json (this shape, serialised)
13
+ // main-agent/prompt.md (optional, referenced by tenantPromptPath)
14
+ // workers/<slug>/SOUL.md (optional, referenced by systemPromptPath)
15
+ export {};
16
+ //# sourceMappingURL=solution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solution.js","sourceRoot":"","sources":["../src/solution.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,8DAA8D;AAC9D,EAAE;AACF,mDAAmD;AACnD,oEAAoE;AACpE,mEAAmE;AACnE,kEAAkE;AAClE,kBAAkB;AAClB,EAAE;AACF,6BAA6B;AAC7B,qCAAqC;AACrC,wDAAwD;AACxD,0EAA0E;AAC1E,0EAA0E"}
@@ -81,16 +81,66 @@ export interface WorkforcePluginInfo {
81
81
  /** Number of skills this plugin currently contributes. */
82
82
  skillCount: number;
83
83
  }
84
+ /** Why a block is in the system prompt. The studio renders the
85
+ * block in two distinct views:
86
+ *
87
+ * - DEVELOP view: every block is listed, tagged with its
88
+ * source + editability. Plugin-injected blocks are
89
+ * read-only; tenant-owned blocks are editable (write
90
+ * support lands later).
91
+ * - RENDERED view: the blocks are concatenated through the
92
+ * same join() the host actually uses, producing the literal
93
+ * text the model sees on its next turn.
94
+ *
95
+ * We keep this enum closed: any new injection point must teach
96
+ * the studio about itself rather than sneaking in as a vague
97
+ * "other" bucket. */
98
+ export type WorkforcePromptBlockKind = "brand" | "runtime-context" | "execution-bias" | "workspace-context" | "reply-style" | "plugin-fragment" | "available-skills" | "user-onboarding" | "tenant-prompt" | "worker-soul" | "worker-context";
99
+ /** One contiguous chunk of the composed system prompt. */
100
+ export interface WorkforcePromptBlock {
101
+ /** Stable kind used by the UI to decide grouping / iconography
102
+ * / editability defaults. */
103
+ kind: WorkforcePromptBlockKind;
104
+ /** Short human label shown in the Develop view's accordion
105
+ * header. */
106
+ title: string;
107
+ /** Where this block came from, for the badge:
108
+ * - "host" : hard-coded in the server, always present
109
+ * - "plugin:<id>" : a plugin's systemPromptFragments[]
110
+ * - "tenant" : tenant-owned override (config / fs file)
111
+ * - "workspace" : tenant/user-authored .md context files
112
+ * We use a stringly-typed `source` so plugin ids appear inline
113
+ * without us inventing a separate field. */
114
+ source: string;
115
+ /** Origin bucket reused from the tool / skill provenance enum
116
+ * so badges stay visually consistent across the page. */
117
+ origin: WorkforceOrigin | "host" | "tenant" | "workspace";
118
+ /** True iff the studio's editor will accept changes to this
119
+ * block. Plugin / host blocks stay false; tenant-owned
120
+ * blocks (tenant prompt, SOUL.md, AGENTS.md, USER.md, …) are
121
+ * true. */
122
+ editable: boolean;
123
+ /** Block body, exactly as it appears in the composed prompt. */
124
+ text: string;
125
+ /** Optional one-line hint shown under the block header in the
126
+ * Develop view. Used for things like "managed by plugin
127
+ * files" or "sourced from <home>/SOUL.md". */
128
+ note?: string;
129
+ }
84
130
  export interface WorkforceMainAgent {
85
131
  /** Brand name from tenant config. */
86
132
  brandName: string;
87
133
  /** Default model id (provider-prefixed). May be null when the
88
134
  * tenant has no models configured. */
89
135
  defaultModelId: string | null;
136
+ /** Block-by-block decomposition of the system prompt. Used by
137
+ * the Develop view; concatenating `blocks.map(b => b.text).
138
+ * join("\n\n")` reproduces (a close approximation of) the
139
+ * rendered text the model sees. */
140
+ blocks: WorkforcePromptBlock[];
90
141
  /** Composed system prompt the agent would receive on the next
91
- * turn if it ran right now. Includes plugin fragments + the
92
- * current skill catalog block; static enough to diff across
93
- * upgrades. */
142
+ * turn if it ran right now. This is the authoritative rendered
143
+ * text the studio shows it in the Rendered view as-is. */
94
144
  systemPrompt: string;
95
145
  /** Every tool currently visible to the main agent. Already
96
146
  * filtered for `available()` and skill-aware gating. */
@@ -121,9 +171,17 @@ export interface WorkforceWorkerAgent {
121
171
  /** Bound model id, or null when the worker uses whatever the
122
172
  * pool/agent loop picks. */
123
173
  modelId: string | null;
174
+ /** Block-by-block decomposition of the worker prompt for the
175
+ * Develop view. Phase 1 reports the stored SOUL.md as a
176
+ * single editable block + worker context fragments; richer
177
+ * decomposition lands when the worker prompt builder is
178
+ * refactored out of agent-loop.ts. */
179
+ blocks: WorkforcePromptBlock[];
124
180
  /** Composed system prompt the worker actually runs with.
125
181
  * Comparable to WorkforceMainAgent.systemPrompt but built
126
- * via the workboard's worker prompt logic. */
182
+ * via the workboard's worker prompt logic. Phase 1 reports
183
+ * the stored SOUL.md verbatim; runtime decomposition is
184
+ * Phase 2 work. */
127
185
  systemPrompt: string;
128
186
  /** Tools the worker is allowed to call after WORKER_DENY_TOOLS
129
187
  * + agent.json toolsAllow filtering. */
@@ -1 +1 @@
1
- {"version":3,"file":"workforce-snapshot.d.ts","sourceRoot":"","sources":["../src/workforce-snapshot.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE1E;iEACiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB;0DACsD;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB;uCACmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB;oCACgC;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;qEACiE;IACjE,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;iCAEiC;AACjC,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,IAAI,EAAE,MAAM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AAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB;oDACgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB;;sBAEkB;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB;;sEAEkE;IAClE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;kCAO8B;IAC9B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC1C"}
@@ -74,6 +74,11 @@ export const KNOWN_CAPABILITIES = {
74
74
  description:
75
75
  "Build a read-only snapshot of the tenant's agent configuration (main agent prompt + tools + skills, every worker agent's prompt + allowed tools + allowed skills). Used by the Workforce Studio plugin to render an inspect-and-export UI; the snapshot includes full skill markdown bodies so the studio can ship a faithful bundle.",
76
76
  },
77
+ "host.solutions": {
78
+ exclusive: true,
79
+ description:
80
+ "Manage Solutions (ADR-0008): declarative descriptions of the desired agent configuration for a tenant. Extract current reality into a named solution, list / read / save / delete solutions, and diff a solution against reality or another solution. Phase 2 has no Apply — solutions are inert files on disk until a later phase reconciles them into reality.",
81
+ },
77
82
  } as const satisfies Record<string, CapabilitySpec>;
78
83
 
79
84
  export type CapabilityName = keyof typeof KNOWN_CAPABILITIES;
@@ -18,6 +18,7 @@ export * from "./catalog.js";
18
18
  export * from "./lsp.js";
19
19
  export * from "./channel-bindings.js";
20
20
  export * from "./workforce-snapshot.js";
21
+ export * from "./solution.js";
21
22
  export {
22
23
  McpToolset,
23
24
  textOfMcpContent,