@bizagent/dsh 0.0.0-stage → 1.0.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 (181) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +21 -0
  3. package/README.md +61 -2
  4. package/cordis.patch.yml +14 -0
  5. package/docs/README.md +23 -0
  6. package/docs/architecture.md +154 -0
  7. package/docs/concepts.md +192 -0
  8. package/docs/configuration.md +154 -0
  9. package/docs/quickstart.md +103 -0
  10. package/docs/quickstart.zh-CN.md +86 -0
  11. package/docs/tools.md +607 -0
  12. package/docs/user-guide.zh-CN.md +132 -0
  13. package/docs/verification.md +69 -0
  14. package/examples/README.md +64 -0
  15. package/examples/demo-runtime.mjs +71 -0
  16. package/examples/learning-lab.mjs +263 -0
  17. package/examples/scenarios.mjs +45 -0
  18. package/lib/agent-preset.d.ts +20 -0
  19. package/lib/agent-preset.js +46 -0
  20. package/lib/agent-session-address.d.ts +14 -0
  21. package/lib/agent-session-address.js +15 -0
  22. package/lib/agent-session-coordinator.d.ts +24 -0
  23. package/lib/agent-session-coordinator.js +101 -0
  24. package/lib/cli.d.ts +3 -0
  25. package/lib/cli.js +142 -0
  26. package/lib/client-types/agent-session-address.d.ts +13 -0
  27. package/lib/client-types/client/agent-mentions.d.ts +3 -0
  28. package/lib/client-types/client/api.d.ts +180 -0
  29. package/lib/client-types/client/components.d.ts +22 -0
  30. package/lib/client-types/client/controller.d.ts +23 -0
  31. package/lib/client-types/client/frame-participants.d.ts +5 -0
  32. package/lib/client-types/client/home-name.d.ts +9 -0
  33. package/lib/client-types/client/human-inbox.d.ts +8 -0
  34. package/lib/client-types/client/index.d.ts +13 -0
  35. package/lib/client-types/client/locales.d.ts +796 -0
  36. package/lib/client-types/client/markdown.d.ts +12 -0
  37. package/lib/client-types/client/project-artifact-link.d.ts +10 -0
  38. package/lib/client-types/client/project-outcome-review-inbox.d.ts +13 -0
  39. package/lib/client-types/client/projects.d.ts +11 -0
  40. package/lib/client-types/client/sample-guide.d.ts +9 -0
  41. package/lib/client-types/client/session-resource.d.ts +34 -0
  42. package/lib/client-types/client/session-surfaces.d.ts +24 -0
  43. package/lib/client-types/client/styles.d.ts +1 -0
  44. package/lib/client-types/config.d.ts +55 -0
  45. package/lib/client-types/cron.d.ts +8 -0
  46. package/lib/client-types/domain.d.ts +818 -0
  47. package/lib/client-types/frame-reference.d.ts +4 -0
  48. package/lib/client-types/home-directory.d.ts +5 -0
  49. package/lib/client-types/home-space.d.ts +49 -0
  50. package/lib/client-types/home-store.d.ts +125 -0
  51. package/lib/client-types/inbox-stalled-topic.d.ts +15 -0
  52. package/lib/client-types/inbox-wake-policy.d.ts +18 -0
  53. package/lib/client-types/known-format.d.ts +2 -0
  54. package/lib/client-types/learning-scheduler.d.ts +36 -0
  55. package/lib/client-types/learning-session-runner.d.ts +49 -0
  56. package/lib/client-types/learning-trigger.d.ts +17 -0
  57. package/lib/client-types/learning-usage.d.ts +17 -0
  58. package/lib/client-types/ledger.d.ts +190 -0
  59. package/lib/client-types/local-owner.d.ts +7 -0
  60. package/lib/client-types/message-source.d.ts +9 -0
  61. package/lib/client-types/organization-location.d.ts +19 -0
  62. package/lib/client-types/project-ledger.d.ts +182 -0
  63. package/lib/client-types/project-seat-context.d.ts +17 -0
  64. package/lib/client-types/safe-file.d.ts +23 -0
  65. package/lib/client-types/sample-organization.d.ts +9 -0
  66. package/lib/client-types/service.d.ts +596 -0
  67. package/lib/client-types/shared-knowledge.d.ts +116 -0
  68. package/lib/client-types/ui-contract.d.ts +276 -0
  69. package/lib/client-types/untrusted-text.d.ts +15 -0
  70. package/lib/client-types/work-ledger.d.ts +108 -0
  71. package/lib/client-types/work-output-eval.d.ts +15 -0
  72. package/lib/client-types/worklog-ledger.d.ts +88 -0
  73. package/lib/client-types/worklog-snapshot.d.ts +33 -0
  74. package/lib/client.js +5463 -0
  75. package/lib/config.d.ts +56 -0
  76. package/lib/config.js +115 -0
  77. package/lib/cron.d.ts +9 -0
  78. package/lib/cron.js +127 -0
  79. package/lib/domain.d.ts +819 -0
  80. package/lib/domain.js +662 -0
  81. package/lib/frame-admission.d.ts +6 -0
  82. package/lib/frame-admission.js +39 -0
  83. package/lib/frame-reference.d.ts +5 -0
  84. package/lib/frame-reference.js +12 -0
  85. package/lib/home-archive.d.ts +17 -0
  86. package/lib/home-archive.js +177 -0
  87. package/lib/home-directory.d.ts +6 -0
  88. package/lib/home-directory.js +38 -0
  89. package/lib/home-space.d.ts +50 -0
  90. package/lib/home-space.js +120 -0
  91. package/lib/home-store.d.ts +126 -0
  92. package/lib/home-store.js +837 -0
  93. package/lib/host.d.ts +22 -0
  94. package/lib/host.js +15 -0
  95. package/lib/human-inbox-transport.d.ts +23 -0
  96. package/lib/human-inbox-transport.js +105 -0
  97. package/lib/human-notification-runner.d.ts +83 -0
  98. package/lib/human-notification-runner.js +138 -0
  99. package/lib/human-notification-webhook.d.ts +18 -0
  100. package/lib/human-notification-webhook.js +102 -0
  101. package/lib/human-turn-completion.d.ts +61 -0
  102. package/lib/human-turn-completion.js +157 -0
  103. package/lib/inbox-return-notifier.d.ts +46 -0
  104. package/lib/inbox-return-notifier.js +279 -0
  105. package/lib/inbox-stalled-escalation-runner.d.ts +31 -0
  106. package/lib/inbox-stalled-escalation-runner.js +68 -0
  107. package/lib/inbox-stalled-topic.d.ts +16 -0
  108. package/lib/inbox-stalled-topic.js +44 -0
  109. package/lib/inbox-wake-policy.d.ts +19 -0
  110. package/lib/inbox-wake-policy.js +28 -0
  111. package/lib/inbox-wake-runner.d.ts +45 -0
  112. package/lib/inbox-wake-runner.js +481 -0
  113. package/lib/index.d.ts +29 -0
  114. package/lib/index.js +480 -0
  115. package/lib/known-format.d.ts +3 -0
  116. package/lib/known-format.js +8 -0
  117. package/lib/learning-scheduler.d.ts +37 -0
  118. package/lib/learning-scheduler.js +182 -0
  119. package/lib/learning-session-runner.d.ts +50 -0
  120. package/lib/learning-session-runner.js +435 -0
  121. package/lib/learning-trigger.d.ts +18 -0
  122. package/lib/learning-trigger.js +92 -0
  123. package/lib/learning-usage.d.ts +18 -0
  124. package/lib/learning-usage.js +49 -0
  125. package/lib/ledger.d.ts +191 -0
  126. package/lib/ledger.js +752 -0
  127. package/lib/local-human-host.d.ts +11 -0
  128. package/lib/local-human-host.js +191 -0
  129. package/lib/local-human-token.d.ts +9 -0
  130. package/lib/local-human-token.js +32 -0
  131. package/lib/local-owner.d.ts +8 -0
  132. package/lib/local-owner.js +26 -0
  133. package/lib/message-source.d.ts +10 -0
  134. package/lib/message-source.js +2 -0
  135. package/lib/organization-location.d.ts +20 -0
  136. package/lib/organization-location.js +80 -0
  137. package/lib/organization-workspace.d.ts +22 -0
  138. package/lib/organization-workspace.js +32 -0
  139. package/lib/project-ledger.d.ts +183 -0
  140. package/lib/project-ledger.js +189 -0
  141. package/lib/project-review-transport.d.ts +23 -0
  142. package/lib/project-review-transport.js +155 -0
  143. package/lib/project-seat-context.d.ts +18 -0
  144. package/lib/project-seat-context.js +34 -0
  145. package/lib/proposal-review-transport.d.ts +26 -0
  146. package/lib/proposal-review-transport.js +104 -0
  147. package/lib/route-guard.d.ts +31 -0
  148. package/lib/route-guard.js +80 -0
  149. package/lib/safe-file.d.ts +24 -0
  150. package/lib/safe-file.js +93 -0
  151. package/lib/sample-organization.d.ts +10 -0
  152. package/lib/sample-organization.js +46 -0
  153. package/lib/service.d.ts +597 -0
  154. package/lib/service.js +4076 -0
  155. package/lib/session-surface.d.ts +11 -0
  156. package/lib/session-surface.js +109 -0
  157. package/lib/shared-knowledge-review-transport.d.ts +28 -0
  158. package/lib/shared-knowledge-review-transport.js +85 -0
  159. package/lib/shared-knowledge.d.ts +117 -0
  160. package/lib/shared-knowledge.js +240 -0
  161. package/lib/tools.d.ts +7 -0
  162. package/lib/tools.js +955 -0
  163. package/lib/ui-contract.d.ts +277 -0
  164. package/lib/ui-contract.js +12 -0
  165. package/lib/ui-host.d.ts +24 -0
  166. package/lib/ui-host.js +471 -0
  167. package/lib/untrusted-text.d.ts +16 -0
  168. package/lib/untrusted-text.js +50 -0
  169. package/lib/work-ledger.d.ts +109 -0
  170. package/lib/work-ledger.js +107 -0
  171. package/lib/work-output-eval.d.ts +16 -0
  172. package/lib/work-output-eval.js +58 -0
  173. package/lib/work-runner.d.ts +47 -0
  174. package/lib/work-runner.js +352 -0
  175. package/lib/worklog-ledger.d.ts +89 -0
  176. package/lib/worklog-ledger.js +91 -0
  177. package/lib/worklog-snapshot.d.ts +34 -0
  178. package/lib/worklog-snapshot.js +100 -0
  179. package/lib/writer-guard.d.ts +11 -0
  180. package/lib/writer-guard.js +207 -0
  181. package/package.json +172 -4
@@ -0,0 +1,116 @@
1
+ import { z } from 'zod';
2
+ declare const DocumentSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ id: z.ZodString;
5
+ scope: z.ZodEnum<{
6
+ line: "line";
7
+ common: "common";
8
+ }>;
9
+ line: z.ZodOptional<z.ZodString>;
10
+ description: z.ZodString;
11
+ proposalId: z.ZodString;
12
+ reviewerId: z.ZodString;
13
+ authorityRef: z.ZodString;
14
+ publishedAt: z.ZodString;
15
+ bodySha256: z.ZodString;
16
+ }, z.core.$strict>;
17
+ export type SharedKnowledgeTarget = {
18
+ scope: 'line';
19
+ line: string;
20
+ } | {
21
+ scope: 'common';
22
+ };
23
+ export type SharedKnowledgeDocument = z.infer<typeof DocumentSchema> & {
24
+ body: string;
25
+ path: string;
26
+ };
27
+ export type PublishSharedKnowledgeInput = SharedKnowledgeTarget & {
28
+ id: string;
29
+ description: string;
30
+ body: string;
31
+ proposalId: string;
32
+ reviewerId: string;
33
+ authorityRef: string;
34
+ publishedAt: string;
35
+ };
36
+ export declare const SharedKnowledgeProposalSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ fromAddress: z.ZodString;
39
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
+ scope: z.ZodLiteral<"line">;
41
+ line: z.ZodString;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ scope: z.ZodLiteral<"common">;
44
+ }, z.core.$strict>], "scope">;
45
+ description: z.ZodString;
46
+ body: z.ZodString;
47
+ sourceRefs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ type: z.ZodLiteral<"session-events">;
49
+ sessionId: z.ZodString;
50
+ fromSeq: z.ZodNumber;
51
+ toSeq: z.ZodNumber;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ type: z.ZodLiteral<"worklog">;
54
+ sessionId: z.ZodString;
55
+ revisionId: z.ZodString;
56
+ fingerprint: z.ZodString;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ type: z.ZodLiteral<"tool-result">;
59
+ sessionId: z.ZodString;
60
+ eventSeq: z.ZodNumber;
61
+ toolCallId: z.ZodString;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ type: z.ZodLiteral<"artifact">;
64
+ uri: z.ZodString;
65
+ digest: z.ZodString;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ type: z.ZodLiteral<"document">;
68
+ uri: z.ZodString;
69
+ digest: z.ZodString;
70
+ authority: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ type: z.ZodLiteral<"asset">;
73
+ ownerAddress: z.ZodString;
74
+ assetId: z.ZodString;
75
+ revision: z.ZodNumber;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ type: z.ZodLiteral<"user-confirmation">;
78
+ sessionId: z.ZodString;
79
+ eventSeq: z.ZodNumber;
80
+ }, z.core.$strip>], "type">>;
81
+ status: z.ZodEnum<{
82
+ rejected: "rejected";
83
+ pending: "pending";
84
+ accepted: "accepted";
85
+ }>;
86
+ humanReview: z.ZodOptional<z.ZodObject<{
87
+ reviewerId: z.ZodString;
88
+ authorityRef: z.ZodString;
89
+ action: z.ZodEnum<{
90
+ accept: "accept";
91
+ reject: "reject";
92
+ }>;
93
+ decision: z.ZodString;
94
+ reviewedAt: z.ZodString;
95
+ }, z.core.$strict>>;
96
+ targetDocumentId: z.ZodOptional<z.ZodString>;
97
+ createdAt: z.ZodString;
98
+ decidedAt: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strict>;
100
+ export type SharedKnowledgeProposal = z.infer<typeof SharedKnowledgeProposalSchema>;
101
+ /** File-backed shared sources. PMO Agent Home knowledge stays in its separate Home directory. */
102
+ export declare class SharedKnowledgeStore {
103
+ readonly root: string;
104
+ constructor(root: string);
105
+ pathFor(target: SharedKnowledgeTarget): string;
106
+ publish(input: PublishSharedKnowledgeInput): Promise<SharedKnowledgeDocument>;
107
+ read(target: SharedKnowledgeTarget, idInput: string): Promise<SharedKnowledgeDocument | undefined>;
108
+ /**
109
+ * Search the shared layers. A document that fails its safety or integrity checks is skipped and
110
+ * reported through `onSkip`, so one hand-edited file cannot break retrieval for every Home.
111
+ */
112
+ search(targets: readonly SharedKnowledgeTarget[], query?: string, onSkip?: (path: string, error: unknown) => void): Promise<SharedKnowledgeDocument[]>;
113
+ private ensureDirectory;
114
+ private safeExistingDirectory;
115
+ }
116
+ export {};
@@ -0,0 +1,276 @@
1
+ import type { AgentHome, AssetKind, AssetStatus, EvidenceRef, FitnessSignal, FrameMode, HomeAddress, HomeType, InboxMessage, InboxDelivery, InboxHumanNotification, HumanNotificationPreference, MemoryProposal, Organization } from './domain.js';
2
+ import type { FormalProject } from './project-ledger.js';
3
+ import type { FormalWork } from './work-ledger.js';
4
+ import type { MemoryUseOutcomePage } from './service.js';
5
+ import type { LearningScheduleStatus } from './learning-scheduler.js';
6
+ import type { HomeDirectoryEntry } from './home-directory.js';
7
+ export declare const BIZAGENT_UI_API = "/api/bizagent/v1";
8
+ /** Organization id of the one-click sample team; the UI shows a getting-started guide for it. */
9
+ export declare const BIZAGENT_SAMPLE_ORGANIZATION_ID = "sample-shop";
10
+ export declare const BIZAGENT_AGENT_DIRECTORY_API = "/api/bizagent/v1/agents";
11
+ export declare const BIZAGENT_PROJECT_REVIEW_API = "/api/bizagent/project-review";
12
+ export declare const BIZAGENT_LOCAL_HUMAN_STATUS_API = "/api/bizagent/local-human/status";
13
+ export declare const BIZAGENT_AGENT_SESSION_API = "/api/bizagent/agent-session";
14
+ export interface UiProjectReviewAccess {
15
+ canReview: boolean;
16
+ revision: number;
17
+ claimId: string | null;
18
+ outcomeReworkNotification?: {
19
+ claimId: string;
20
+ state: 'pending' | 'delivered';
21
+ };
22
+ }
23
+ export interface UiProjectOutcomeReviewInbox {
24
+ items: Array<{
25
+ projectId: string;
26
+ projectTitle: string;
27
+ lead: string;
28
+ goal: string;
29
+ doneWhen: string;
30
+ revision: number;
31
+ claimId: string;
32
+ submittedAt: string;
33
+ summary: string;
34
+ body: string;
35
+ doneWhenAssessment: string;
36
+ work: Array<{
37
+ id: string;
38
+ status: 'completed' | 'cancelled';
39
+ resultSubject?: string;
40
+ resultBody?: string;
41
+ resultArtifacts?: Array<{
42
+ path: string;
43
+ sha256: string;
44
+ bytes: number;
45
+ }>;
46
+ }>;
47
+ artifacts: Array<{
48
+ path: string;
49
+ sha256: string;
50
+ bytes: number;
51
+ }>;
52
+ }>;
53
+ nextOffset?: number;
54
+ }
55
+ export declare const BIZAGENT_FRAME_STATUS_API = "/api/bizagent/v1/frames";
56
+ export declare const BIZAGENT_HUMAN_INBOX_API = "/api/bizagent/human-inbox";
57
+ export declare const BIZAGENT_SESSION_CONTEXT_API = "/api/bizagent/v1/session-context";
58
+ export declare const BIZAGENT_SESSION_CATALOG_API = "/api/bizagent/v1/sessions";
59
+ export type UiSessionKind = 'conversation' | 'principal' | 'project-main' | 'work' | 'learning' | 'inbox';
60
+ export type UiAgentRuntime = 'running' | 'idle' | 'unloaded';
61
+ export interface UiSessionSummary {
62
+ sessionId: string;
63
+ home: UiFrameParticipation['primaryHome'];
64
+ kind: UiSessionKind;
65
+ runtime: UiAgentRuntime;
66
+ projectId?: string;
67
+ projectTitle?: string;
68
+ workId?: string;
69
+ workGoal?: string;
70
+ workStatus?: FormalWork['status'];
71
+ }
72
+ export interface UiSessionActivity {
73
+ id: string;
74
+ turn: number;
75
+ seq: number;
76
+ kind: 'memory' | 'proposal' | 'work' | 'project' | 'frame' | 'learning';
77
+ action: string;
78
+ title: string;
79
+ status?: string;
80
+ entityId?: string;
81
+ }
82
+ export interface UiSessionContext {
83
+ summary: UiSessionSummary;
84
+ frames: UiFrameParticipation['frames'];
85
+ home: {
86
+ activeAssets: number;
87
+ candidates: number;
88
+ pendingProposals: number;
89
+ };
90
+ work: Array<Pick<FormalWork, 'id' | 'goal' | 'requester' | 'assignee' | 'status' | 'updatedAt' | 'workerSessionId' | 'returnToSessionId' | 'projectId' | 'resultSubject' | 'resultBody' | 'resultArtifacts'> & {
91
+ runtime: UiAgentRuntime;
92
+ requesterName: string;
93
+ assigneeName: string;
94
+ }>;
95
+ projects: Array<Pick<FormalProject, 'id' | 'title' | 'status' | 'goal'>>;
96
+ activity: UiSessionActivity[];
97
+ moreWork: boolean;
98
+ }
99
+ export type UiHumanInboxSummary = Pick<InboxMessage, 'id' | 'fromAddress' | 'to' | 'cc' | 'subject' | 'kind' | 'priority' | 'due' | 'replyTo' | 'humanAction' | 'sentAt'> & {
100
+ delivery?: InboxDelivery;
101
+ notification?: InboxHumanNotification;
102
+ };
103
+ export interface UiHumanInboxList {
104
+ address: string;
105
+ notificationPreference: Pick<HumanNotificationPreference, 'recipient' | 'enabled' | 'revision'> & {
106
+ updatedAt?: string;
107
+ };
108
+ messages: UiHumanInboxSummary[];
109
+ nextBeforeMessageId?: string;
110
+ }
111
+ export interface UiHumanInboxDetail {
112
+ message: InboxMessage;
113
+ delivery?: InboxDelivery;
114
+ notification?: InboxHumanNotification;
115
+ }
116
+ export type LearningKind = Exclude<AssetKind, 'identity'>;
117
+ export type UiLearningSchedule = LearningScheduleStatus;
118
+ export type UiMemoryUseOutcomes = MemoryUseOutcomePage;
119
+ export type UiAgentDirectory = {
120
+ count: number;
121
+ homes: HomeDirectoryEntry[];
122
+ };
123
+ export type UiAgentTarget = HomeDirectoryEntry;
124
+ export interface UiFrameParticipation {
125
+ sessionId: string;
126
+ primaryHome: {
127
+ address: HomeAddress;
128
+ displayName: string;
129
+ scope: UiHomeSummary['scope'];
130
+ };
131
+ frames: Array<{
132
+ address: HomeAddress;
133
+ displayName: string;
134
+ mode: FrameMode;
135
+ focused: boolean;
136
+ refreshRequired: boolean;
137
+ }>;
138
+ }
139
+ export interface UiAssetCounts {
140
+ memory: number;
141
+ insight: number;
142
+ knowledge: number;
143
+ method: number;
144
+ }
145
+ export interface UiHomeSummary {
146
+ address: HomeAddress;
147
+ /** Host-known Workspace for an explicitly bound Business Home chat. */
148
+ chatWorkspacePath?: string;
149
+ /** `personal` for the person's own Homes in the data root, outside any organization. */
150
+ scope: 'personal' | 'organization';
151
+ type: HomeType;
152
+ displayName: string;
153
+ revision: number;
154
+ status: AgentHome['status'];
155
+ updatedAt: string;
156
+ assetCount: number;
157
+ activeAssetCount: number;
158
+ counts: UiAssetCounts;
159
+ incomingPending: number;
160
+ outgoingPending: number;
161
+ episodes: number;
162
+ }
163
+ export interface UiAsset {
164
+ id: string;
165
+ ownerAddress: HomeAddress;
166
+ kind: LearningKind;
167
+ title?: string;
168
+ description: string;
169
+ body: string;
170
+ tags: string[];
171
+ sourceRefs: EvidenceRef[];
172
+ confidence: number;
173
+ fitness: number;
174
+ status: AssetStatus;
175
+ revision: number;
176
+ proposalId?: string;
177
+ proposalApplications?: Array<{
178
+ proposalId: string;
179
+ revision: number;
180
+ bodySha256: string;
181
+ }>;
182
+ createdAt: string;
183
+ updatedAt: string;
184
+ receiptCount: number;
185
+ lastSignal?: FitnessSignal;
186
+ }
187
+ export interface UiHomeDetail {
188
+ home: AgentHome;
189
+ identity: string;
190
+ assets: UiAsset[];
191
+ proposals: MemoryProposal[];
192
+ episodes: number;
193
+ worklogCount: number;
194
+ worklogs: Array<{
195
+ id: string;
196
+ sessionId: string;
197
+ revision: number;
198
+ description: string;
199
+ body: string;
200
+ status: 'ongoing' | 'completed' | 'blocked' | 'failed';
201
+ origin?: 'agent' | 'work-result' | 'session-activity';
202
+ recordedAt: string;
203
+ files: string[];
204
+ workId?: string;
205
+ projectId?: string;
206
+ }>;
207
+ }
208
+ export interface UiOverview {
209
+ generatedAt: string;
210
+ /** BizAgent data root: the personal space, with organizations under `orgs/`. */
211
+ homeRoot: string;
212
+ organizationLocation?: {
213
+ organizationId: string;
214
+ organizationRoot: string;
215
+ /** Set for an organization still at its pre-1.0 place, `<workspace>/bizagent/<id>`. */
216
+ legacyWorkspacePath?: string;
217
+ };
218
+ organization?: Organization;
219
+ homes: UiHomeSummary[];
220
+ proposals: MemoryProposal[];
221
+ totals: {
222
+ homes: number;
223
+ assets: number;
224
+ activeAssets: number;
225
+ pendingProposals: number;
226
+ episodes: number;
227
+ };
228
+ health: {
229
+ ok: boolean;
230
+ issues: string[];
231
+ };
232
+ }
233
+ export interface UiCreateHomeRequest {
234
+ address: string;
235
+ displayName?: string;
236
+ owner?: string;
237
+ identity?: string;
238
+ }
239
+ export interface UiCreateOrganizationRequest {
240
+ id: string;
241
+ name: string;
242
+ mission: string;
243
+ members: Array<{
244
+ id: string;
245
+ displayName: string;
246
+ roleId: string;
247
+ roleName: string;
248
+ responsibility: string;
249
+ }>;
250
+ capabilities: Array<{
251
+ id: string;
252
+ displayName: string;
253
+ responsibility: string;
254
+ }>;
255
+ }
256
+ export interface UiProposalDecisionRequest {
257
+ ownerAddress: string;
258
+ proposalId: string;
259
+ action: 'accept' | 'reject';
260
+ decision: string;
261
+ }
262
+ export interface UiApiError {
263
+ error: {
264
+ code: string;
265
+ message: string;
266
+ };
267
+ }
268
+ export interface UiProjectList {
269
+ homeAddress: HomeAddress;
270
+ projects: FormalProject[];
271
+ nextBeforeProjectId?: string;
272
+ }
273
+ export interface UiProjectDetail {
274
+ project: FormalProject;
275
+ work: FormalWork[];
276
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helpers for text that another Home, Agent, or person wrote and that this plugin places in
3
+ * model-facing messages. Single-line fields stay on one line; multi-line content is fenced as data.
4
+ */
5
+ /** Render one foreign field on a single line; line breaks and control characters become visible escapes. */
6
+ export declare function inlineText(value: string): string;
7
+ /**
8
+ * Place multi-line foreign content in a clearly delimited data block. The fence is longer than any
9
+ * backtick run inside the content, so the content cannot close it and continue as plugin text.
10
+ */
11
+ export declare function untrustedBlock(label: string, content: string): string;
12
+ /** Write-time check for subjects, goals, titles, and other single-line fields. */
13
+ export declare function assertSingleLineText(value: string, label: string): void;
14
+ /** Write-time check for multi-line bodies: newline and tab are the only allowed control characters. */
15
+ export declare function assertBodyText(value: string, label: string): void;
@@ -0,0 +1,108 @@
1
+ import { type DomainFacility } from '@deepseek-ai/dsh-storage-domain';
2
+ import { z } from 'zod';
3
+ import { type HomeAddress } from './domain.js';
4
+ export declare const FormalWorkSchema: z.ZodObject<{
5
+ schemaVersion: z.ZodLiteral<1>;
6
+ id: z.ZodString;
7
+ idempotencyKey: z.ZodString;
8
+ requester: z.ZodString;
9
+ assignee: z.ZodString;
10
+ returnToSessionId: z.ZodString;
11
+ goal: z.ZodString;
12
+ acceptanceCriteria: z.ZodString;
13
+ projectId: z.ZodOptional<z.ZodString>;
14
+ status: z.ZodEnum<{
15
+ open: "open";
16
+ completed: "completed";
17
+ accepted: "accepted";
18
+ cancelled: "cancelled";
19
+ completing: "completing";
20
+ }>;
21
+ requestMessageId: z.ZodString;
22
+ autoStart: z.ZodOptional<z.ZodBoolean>;
23
+ workerSessionId: z.ZodOptional<z.ZodString>;
24
+ workerCwd: z.ZodOptional<z.ZodString>;
25
+ workerOptions: z.ZodOptional<z.ZodObject<{
26
+ provider: z.ZodOptional<z.ZodString>;
27
+ model: z.ZodOptional<z.ZodString>;
28
+ maxTokens: z.ZodOptional<z.ZodNumber>;
29
+ }, z.core.$strip>>;
30
+ acceptedAt: z.ZodOptional<z.ZodString>;
31
+ resultMessageId: z.ZodOptional<z.ZodString>;
32
+ resultSubject: z.ZodOptional<z.ZodString>;
33
+ resultBody: z.ZodOptional<z.ZodString>;
34
+ resultSessionId: z.ZodOptional<z.ZodString>;
35
+ resultArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
36
+ path: z.ZodString;
37
+ sha256: z.ZodString;
38
+ bytes: z.ZodNumber;
39
+ snapshot: z.ZodLiteral<true>;
40
+ }, z.core.$strip>>>;
41
+ createdAt: z.ZodString;
42
+ updatedAt: z.ZodString;
43
+ completedAt: z.ZodOptional<z.ZodString>;
44
+ cancelledAt: z.ZodOptional<z.ZodString>;
45
+ cancelMessageId: z.ZodOptional<z.ZodString>;
46
+ cancelReason: z.ZodOptional<z.ZodString>;
47
+ cancelledBySessionId: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ export type FormalWork = Omit<z.infer<typeof FormalWorkSchema>, 'requester' | 'assignee'> & {
50
+ requester: HomeAddress;
51
+ assignee: HomeAddress;
52
+ };
53
+ export declare const BIZAGENT_WORK_DOMAIN: {
54
+ name: string;
55
+ version: number;
56
+ tables: {
57
+ works: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
58
+ schemaVersion: 1;
59
+ id: string;
60
+ idempotencyKey: string;
61
+ requester: string;
62
+ assignee: string;
63
+ returnToSessionId: string;
64
+ goal: string;
65
+ acceptanceCriteria: string;
66
+ status: "open" | "completed" | "accepted" | "cancelled" | "completing";
67
+ requestMessageId: string;
68
+ createdAt: string;
69
+ updatedAt: string;
70
+ projectId?: string | undefined;
71
+ autoStart?: boolean | undefined;
72
+ workerSessionId?: string | undefined;
73
+ workerCwd?: string | undefined;
74
+ workerOptions?: {
75
+ provider?: string | undefined;
76
+ model?: string | undefined;
77
+ maxTokens?: number | undefined;
78
+ } | undefined;
79
+ acceptedAt?: string | undefined;
80
+ resultMessageId?: string | undefined;
81
+ resultSubject?: string | undefined;
82
+ resultBody?: string | undefined;
83
+ resultSessionId?: string | undefined;
84
+ resultArtifacts?: {
85
+ path: string;
86
+ sha256: string;
87
+ bytes: number;
88
+ snapshot: true;
89
+ }[] | undefined;
90
+ completedAt?: string | undefined;
91
+ cancelledAt?: string | undefined;
92
+ cancelMessageId?: string | undefined;
93
+ cancelReason?: string | undefined;
94
+ cancelledBySessionId?: string | undefined;
95
+ }>;
96
+ };
97
+ };
98
+ export declare class WorkLedger {
99
+ private readonly domain;
100
+ private mutationTail;
101
+ private constructor();
102
+ static open(facility: DomainFacility): Promise<WorkLedger>;
103
+ withWrite<T>(update: () => Promise<T>): Promise<T>;
104
+ get(id: string): FormalWork | undefined;
105
+ list(): FormalWork[];
106
+ put(work: FormalWork): Promise<void>;
107
+ close(): Promise<void>;
108
+ }
@@ -0,0 +1,15 @@
1
+ export type WorkOutputVerdict = {
2
+ checker: 'empty-content' | 'placeholder-leak';
3
+ result: 'pass' | 'fail' | 'skip';
4
+ reason?: string;
5
+ evidence?: string;
6
+ };
7
+ export type WorkOutputSourceEvaluation = {
8
+ kind: 'artifact' | 'result-body';
9
+ path?: string;
10
+ sha256: string;
11
+ bytes: number;
12
+ verdicts: WorkOutputVerdict[];
13
+ };
14
+ /** Deterministic assertions on a frozen Work result. Verdicts are observations, not acceptance decisions. */
15
+ export declare function evaluateWorkOutput(kind: 'artifact' | 'result-body', bytes: Uint8Array, path?: string): WorkOutputSourceEvaluation;
@@ -0,0 +1,88 @@
1
+ import { type DomainFacility } from '@deepseek-ai/dsh-storage-domain';
2
+ import { z } from 'zod';
3
+ import { type HomeAddress } from './domain.js';
4
+ export declare const WorklogRevisionSchema: z.ZodObject<{
5
+ schemaVersion: z.ZodLiteral<1>;
6
+ id: z.ZodString;
7
+ sessionId: z.ZodString;
8
+ homeAddress: z.ZodString;
9
+ revision: z.ZodNumber;
10
+ idempotencyKey: z.ZodString;
11
+ description: z.ZodString;
12
+ body: z.ZodString;
13
+ status: z.ZodEnum<{
14
+ completed: "completed";
15
+ failed: "failed";
16
+ ongoing: "ongoing";
17
+ blocked: "blocked";
18
+ }>;
19
+ origin: z.ZodOptional<z.ZodEnum<{
20
+ "work-result": "work-result";
21
+ agent: "agent";
22
+ "session-activity": "session-activity";
23
+ }>>;
24
+ cwd: z.ZodOptional<z.ZodString>;
25
+ evidence: z.ZodObject<{
26
+ fromSeq: z.ZodNumber;
27
+ toSeq: z.ZodNumber;
28
+ fingerprint: z.ZodString;
29
+ }, z.core.$strip>;
30
+ files: z.ZodArray<z.ZodObject<{
31
+ path: z.ZodString;
32
+ sha256: z.ZodString;
33
+ bytes: z.ZodNumber;
34
+ snapshot: z.ZodOptional<z.ZodLiteral<true>>;
35
+ }, z.core.$strip>>;
36
+ projectId: z.ZodOptional<z.ZodString>;
37
+ workId: z.ZodOptional<z.ZodString>;
38
+ recordedAt: z.ZodString;
39
+ }, z.core.$strip>;
40
+ export type WorklogRevision = Omit<z.infer<typeof WorklogRevisionSchema>, 'homeAddress'> & {
41
+ homeAddress: HomeAddress;
42
+ };
43
+ export declare const BIZAGENT_WORKLOG_DOMAIN: {
44
+ name: string;
45
+ version: number;
46
+ tables: {
47
+ revisions: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
48
+ schemaVersion: 1;
49
+ id: string;
50
+ sessionId: string;
51
+ homeAddress: string;
52
+ revision: number;
53
+ idempotencyKey: string;
54
+ description: string;
55
+ body: string;
56
+ status: "completed" | "failed" | "ongoing" | "blocked";
57
+ evidence: {
58
+ fromSeq: number;
59
+ toSeq: number;
60
+ fingerprint: string;
61
+ };
62
+ files: {
63
+ path: string;
64
+ sha256: string;
65
+ bytes: number;
66
+ snapshot?: true | undefined;
67
+ }[];
68
+ recordedAt: string;
69
+ origin?: "work-result" | "agent" | "session-activity" | undefined;
70
+ cwd?: string | undefined;
71
+ projectId?: string | undefined;
72
+ workId?: string | undefined;
73
+ }>;
74
+ };
75
+ };
76
+ export declare class WorklogLedger {
77
+ private readonly domain;
78
+ private mutationTail;
79
+ private constructor();
80
+ static open(facility: DomainFacility): Promise<WorklogLedger>;
81
+ withWrite<T>(update: () => Promise<T>): Promise<T>;
82
+ get(id: string): WorklogRevision | undefined;
83
+ listVersions(sessionId: string): WorklogRevision[];
84
+ listLatest(homeAddress: HomeAddress): WorklogRevision[];
85
+ put(revision: WorklogRevision): Promise<void>;
86
+ close(): Promise<void>;
87
+ private all;
88
+ }
@@ -0,0 +1,33 @@
1
+ export declare const WORKLOG_SNAPSHOT_DIRECTORY = "worklog-snapshots/sha256";
2
+ export declare const PROJECT_SNAPSHOT_DIRECTORY = "project-snapshots/sha256";
3
+ export declare const WORK_SNAPSHOT_DIRECTORY = "work-snapshots/sha256";
4
+ export declare const LEARNING_SNAPSHOT_DIRECTORY = "learning-snapshots/sha256";
5
+ export declare const MAX_WORKLOG_FILE_BYTES: number;
6
+ export declare function worklogSnapshotPath(sha256: string): string;
7
+ export declare function projectSnapshotPath(sha256: string): string;
8
+ export declare function workSnapshotPath(sha256: string): string;
9
+ export declare function learningSnapshotPath(sha256: string): string;
10
+ /** Immutable objects live under the Home root, so Home archives carry them. */
11
+ declare class HomeSnapshotStore {
12
+ private readonly homeRoot;
13
+ private readonly directoryName;
14
+ constructor(homeRoot: string, directoryName: string);
15
+ retain(bytes: Uint8Array): Promise<{
16
+ sha256: string;
17
+ bytes: number;
18
+ }>;
19
+ read(sha256: string, expectedBytes?: number): Promise<Buffer>;
20
+ }
21
+ export declare class WorklogSnapshotStore extends HomeSnapshotStore {
22
+ constructor(homeRoot: string);
23
+ }
24
+ export declare class ProjectSnapshotStore extends HomeSnapshotStore {
25
+ constructor(homeRoot: string);
26
+ }
27
+ export declare class WorkSnapshotStore extends HomeSnapshotStore {
28
+ constructor(homeRoot: string);
29
+ }
30
+ export declare class LearningSnapshotStore extends HomeSnapshotStore {
31
+ constructor(homeRoot: string);
32
+ }
33
+ export {};