@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.
- package/CHANGELOG.md +124 -0
- package/LICENSE +21 -0
- package/README.md +61 -2
- package/cordis.patch.yml +14 -0
- package/docs/README.md +23 -0
- package/docs/architecture.md +154 -0
- package/docs/concepts.md +192 -0
- package/docs/configuration.md +154 -0
- package/docs/quickstart.md +103 -0
- package/docs/quickstart.zh-CN.md +86 -0
- package/docs/tools.md +607 -0
- package/docs/user-guide.zh-CN.md +132 -0
- package/docs/verification.md +69 -0
- package/examples/README.md +64 -0
- package/examples/demo-runtime.mjs +71 -0
- package/examples/learning-lab.mjs +263 -0
- package/examples/scenarios.mjs +45 -0
- package/lib/agent-preset.d.ts +20 -0
- package/lib/agent-preset.js +46 -0
- package/lib/agent-session-address.d.ts +14 -0
- package/lib/agent-session-address.js +15 -0
- package/lib/agent-session-coordinator.d.ts +24 -0
- package/lib/agent-session-coordinator.js +101 -0
- package/lib/cli.d.ts +3 -0
- package/lib/cli.js +142 -0
- package/lib/client-types/agent-session-address.d.ts +13 -0
- package/lib/client-types/client/agent-mentions.d.ts +3 -0
- package/lib/client-types/client/api.d.ts +180 -0
- package/lib/client-types/client/components.d.ts +22 -0
- package/lib/client-types/client/controller.d.ts +23 -0
- package/lib/client-types/client/frame-participants.d.ts +5 -0
- package/lib/client-types/client/home-name.d.ts +9 -0
- package/lib/client-types/client/human-inbox.d.ts +8 -0
- package/lib/client-types/client/index.d.ts +13 -0
- package/lib/client-types/client/locales.d.ts +796 -0
- package/lib/client-types/client/markdown.d.ts +12 -0
- package/lib/client-types/client/project-artifact-link.d.ts +10 -0
- package/lib/client-types/client/project-outcome-review-inbox.d.ts +13 -0
- package/lib/client-types/client/projects.d.ts +11 -0
- package/lib/client-types/client/sample-guide.d.ts +9 -0
- package/lib/client-types/client/session-resource.d.ts +34 -0
- package/lib/client-types/client/session-surfaces.d.ts +24 -0
- package/lib/client-types/client/styles.d.ts +1 -0
- package/lib/client-types/config.d.ts +55 -0
- package/lib/client-types/cron.d.ts +8 -0
- package/lib/client-types/domain.d.ts +818 -0
- package/lib/client-types/frame-reference.d.ts +4 -0
- package/lib/client-types/home-directory.d.ts +5 -0
- package/lib/client-types/home-space.d.ts +49 -0
- package/lib/client-types/home-store.d.ts +125 -0
- package/lib/client-types/inbox-stalled-topic.d.ts +15 -0
- package/lib/client-types/inbox-wake-policy.d.ts +18 -0
- package/lib/client-types/known-format.d.ts +2 -0
- package/lib/client-types/learning-scheduler.d.ts +36 -0
- package/lib/client-types/learning-session-runner.d.ts +49 -0
- package/lib/client-types/learning-trigger.d.ts +17 -0
- package/lib/client-types/learning-usage.d.ts +17 -0
- package/lib/client-types/ledger.d.ts +190 -0
- package/lib/client-types/local-owner.d.ts +7 -0
- package/lib/client-types/message-source.d.ts +9 -0
- package/lib/client-types/organization-location.d.ts +19 -0
- package/lib/client-types/project-ledger.d.ts +182 -0
- package/lib/client-types/project-seat-context.d.ts +17 -0
- package/lib/client-types/safe-file.d.ts +23 -0
- package/lib/client-types/sample-organization.d.ts +9 -0
- package/lib/client-types/service.d.ts +596 -0
- package/lib/client-types/shared-knowledge.d.ts +116 -0
- package/lib/client-types/ui-contract.d.ts +276 -0
- package/lib/client-types/untrusted-text.d.ts +15 -0
- package/lib/client-types/work-ledger.d.ts +108 -0
- package/lib/client-types/work-output-eval.d.ts +15 -0
- package/lib/client-types/worklog-ledger.d.ts +88 -0
- package/lib/client-types/worklog-snapshot.d.ts +33 -0
- package/lib/client.js +5463 -0
- package/lib/config.d.ts +56 -0
- package/lib/config.js +115 -0
- package/lib/cron.d.ts +9 -0
- package/lib/cron.js +127 -0
- package/lib/domain.d.ts +819 -0
- package/lib/domain.js +662 -0
- package/lib/frame-admission.d.ts +6 -0
- package/lib/frame-admission.js +39 -0
- package/lib/frame-reference.d.ts +5 -0
- package/lib/frame-reference.js +12 -0
- package/lib/home-archive.d.ts +17 -0
- package/lib/home-archive.js +177 -0
- package/lib/home-directory.d.ts +6 -0
- package/lib/home-directory.js +38 -0
- package/lib/home-space.d.ts +50 -0
- package/lib/home-space.js +120 -0
- package/lib/home-store.d.ts +126 -0
- package/lib/home-store.js +837 -0
- package/lib/host.d.ts +22 -0
- package/lib/host.js +15 -0
- package/lib/human-inbox-transport.d.ts +23 -0
- package/lib/human-inbox-transport.js +105 -0
- package/lib/human-notification-runner.d.ts +83 -0
- package/lib/human-notification-runner.js +138 -0
- package/lib/human-notification-webhook.d.ts +18 -0
- package/lib/human-notification-webhook.js +102 -0
- package/lib/human-turn-completion.d.ts +61 -0
- package/lib/human-turn-completion.js +157 -0
- package/lib/inbox-return-notifier.d.ts +46 -0
- package/lib/inbox-return-notifier.js +279 -0
- package/lib/inbox-stalled-escalation-runner.d.ts +31 -0
- package/lib/inbox-stalled-escalation-runner.js +68 -0
- package/lib/inbox-stalled-topic.d.ts +16 -0
- package/lib/inbox-stalled-topic.js +44 -0
- package/lib/inbox-wake-policy.d.ts +19 -0
- package/lib/inbox-wake-policy.js +28 -0
- package/lib/inbox-wake-runner.d.ts +45 -0
- package/lib/inbox-wake-runner.js +481 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.js +480 -0
- package/lib/known-format.d.ts +3 -0
- package/lib/known-format.js +8 -0
- package/lib/learning-scheduler.d.ts +37 -0
- package/lib/learning-scheduler.js +182 -0
- package/lib/learning-session-runner.d.ts +50 -0
- package/lib/learning-session-runner.js +435 -0
- package/lib/learning-trigger.d.ts +18 -0
- package/lib/learning-trigger.js +92 -0
- package/lib/learning-usage.d.ts +18 -0
- package/lib/learning-usage.js +49 -0
- package/lib/ledger.d.ts +191 -0
- package/lib/ledger.js +752 -0
- package/lib/local-human-host.d.ts +11 -0
- package/lib/local-human-host.js +191 -0
- package/lib/local-human-token.d.ts +9 -0
- package/lib/local-human-token.js +32 -0
- package/lib/local-owner.d.ts +8 -0
- package/lib/local-owner.js +26 -0
- package/lib/message-source.d.ts +10 -0
- package/lib/message-source.js +2 -0
- package/lib/organization-location.d.ts +20 -0
- package/lib/organization-location.js +80 -0
- package/lib/organization-workspace.d.ts +22 -0
- package/lib/organization-workspace.js +32 -0
- package/lib/project-ledger.d.ts +183 -0
- package/lib/project-ledger.js +189 -0
- package/lib/project-review-transport.d.ts +23 -0
- package/lib/project-review-transport.js +155 -0
- package/lib/project-seat-context.d.ts +18 -0
- package/lib/project-seat-context.js +34 -0
- package/lib/proposal-review-transport.d.ts +26 -0
- package/lib/proposal-review-transport.js +104 -0
- package/lib/route-guard.d.ts +31 -0
- package/lib/route-guard.js +80 -0
- package/lib/safe-file.d.ts +24 -0
- package/lib/safe-file.js +93 -0
- package/lib/sample-organization.d.ts +10 -0
- package/lib/sample-organization.js +46 -0
- package/lib/service.d.ts +597 -0
- package/lib/service.js +4076 -0
- package/lib/session-surface.d.ts +11 -0
- package/lib/session-surface.js +109 -0
- package/lib/shared-knowledge-review-transport.d.ts +28 -0
- package/lib/shared-knowledge-review-transport.js +85 -0
- package/lib/shared-knowledge.d.ts +117 -0
- package/lib/shared-knowledge.js +240 -0
- package/lib/tools.d.ts +7 -0
- package/lib/tools.js +955 -0
- package/lib/ui-contract.d.ts +277 -0
- package/lib/ui-contract.js +12 -0
- package/lib/ui-host.d.ts +24 -0
- package/lib/ui-host.js +471 -0
- package/lib/untrusted-text.d.ts +16 -0
- package/lib/untrusted-text.js +50 -0
- package/lib/work-ledger.d.ts +109 -0
- package/lib/work-ledger.js +107 -0
- package/lib/work-output-eval.d.ts +16 -0
- package/lib/work-output-eval.js +58 -0
- package/lib/work-runner.d.ts +47 -0
- package/lib/work-runner.js +352 -0
- package/lib/worklog-ledger.d.ts +89 -0
- package/lib/worklog-ledger.js +91 -0
- package/lib/worklog-snapshot.d.ts +34 -0
- package/lib/worklog-snapshot.js +100 -0
- package/lib/writer-guard.d.ts +11 -0
- package/lib/writer-guard.js +207 -0
- package/package.json +172 -4
|
@@ -0,0 +1,182 @@
|
|
|
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 ProjectSeatSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
address: z.ZodString;
|
|
7
|
+
homeAddress: z.ZodString;
|
|
8
|
+
responsibility: z.ZodString;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
active: "active";
|
|
11
|
+
released: "released";
|
|
12
|
+
}>;
|
|
13
|
+
joinedAt: z.ZodString;
|
|
14
|
+
updatedAt: z.ZodString;
|
|
15
|
+
releasedAt: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type ProjectSeat = Omit<z.infer<typeof ProjectSeatSchema>, 'homeAddress'> & {
|
|
18
|
+
homeAddress: HomeAddress;
|
|
19
|
+
};
|
|
20
|
+
export declare const FormalProjectSchema: z.ZodObject<{
|
|
21
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
idempotencyKey: z.ZodString;
|
|
24
|
+
lead: z.ZodString;
|
|
25
|
+
driver: z.ZodOptional<z.ZodString>;
|
|
26
|
+
createdBySessionId: z.ZodString;
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
goal: z.ZodString;
|
|
29
|
+
doneWhen: z.ZodString;
|
|
30
|
+
status: z.ZodEnum<{
|
|
31
|
+
open: "open";
|
|
32
|
+
accepted: "accepted";
|
|
33
|
+
awaiting_acceptance: "awaiting_acceptance";
|
|
34
|
+
}>;
|
|
35
|
+
revision: z.ZodNumber;
|
|
36
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
summary: z.ZodString;
|
|
39
|
+
body: z.ZodString;
|
|
40
|
+
doneWhenAssessment: z.ZodString;
|
|
41
|
+
work: z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
completed: "completed";
|
|
45
|
+
cancelled: "cancelled";
|
|
46
|
+
}>;
|
|
47
|
+
resultMessageId: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
path: z.ZodString;
|
|
51
|
+
sha256: z.ZodString;
|
|
52
|
+
bytes: z.ZodNumber;
|
|
53
|
+
snapshot: z.ZodLiteral<true>;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
submittedBySessionId: z.ZodString;
|
|
56
|
+
submittedAt: z.ZodString;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
reviews: z.ZodArray<z.ZodObject<{
|
|
59
|
+
claimId: z.ZodString;
|
|
60
|
+
decision: z.ZodEnum<{
|
|
61
|
+
accept: "accept";
|
|
62
|
+
rework: "rework";
|
|
63
|
+
}>;
|
|
64
|
+
reason: z.ZodString;
|
|
65
|
+
reviewedBySessionId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
reviewedByPrincipal: z.ZodOptional<z.ZodString>;
|
|
67
|
+
reviewedAt: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
seats: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
address: z.ZodString;
|
|
72
|
+
homeAddress: z.ZodString;
|
|
73
|
+
responsibility: z.ZodString;
|
|
74
|
+
status: z.ZodEnum<{
|
|
75
|
+
active: "active";
|
|
76
|
+
released: "released";
|
|
77
|
+
}>;
|
|
78
|
+
joinedAt: z.ZodString;
|
|
79
|
+
updatedAt: z.ZodString;
|
|
80
|
+
releasedAt: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
seatEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
83
|
+
seatAddress: z.ZodString;
|
|
84
|
+
homeAddress: z.ZodString;
|
|
85
|
+
action: z.ZodEnum<{
|
|
86
|
+
released: "released";
|
|
87
|
+
joined: "joined";
|
|
88
|
+
"responsibility-updated": "responsibility-updated";
|
|
89
|
+
rejoined: "rejoined";
|
|
90
|
+
}>;
|
|
91
|
+
responsibility: z.ZodString;
|
|
92
|
+
bySessionId: z.ZodString;
|
|
93
|
+
at: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>>;
|
|
95
|
+
currentClaimId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
acceptedClaimId: z.ZodOptional<z.ZodString>;
|
|
97
|
+
createdAt: z.ZodString;
|
|
98
|
+
updatedAt: z.ZodString;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type FormalProject = Omit<z.infer<typeof FormalProjectSchema>, 'lead' | 'seats'> & {
|
|
101
|
+
lead: HomeAddress;
|
|
102
|
+
seats?: ProjectSeat[];
|
|
103
|
+
};
|
|
104
|
+
export declare const BIZAGENT_PROJECT_DOMAIN: {
|
|
105
|
+
name: string;
|
|
106
|
+
version: number;
|
|
107
|
+
tables: {
|
|
108
|
+
projects: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
|
|
109
|
+
schemaVersion: 1;
|
|
110
|
+
id: string;
|
|
111
|
+
idempotencyKey: string;
|
|
112
|
+
lead: string;
|
|
113
|
+
createdBySessionId: string;
|
|
114
|
+
title: string;
|
|
115
|
+
goal: string;
|
|
116
|
+
doneWhen: string;
|
|
117
|
+
status: "open" | "accepted" | "awaiting_acceptance";
|
|
118
|
+
revision: number;
|
|
119
|
+
claims: {
|
|
120
|
+
id: string;
|
|
121
|
+
summary: string;
|
|
122
|
+
body: string;
|
|
123
|
+
doneWhenAssessment: string;
|
|
124
|
+
work: {
|
|
125
|
+
id: string;
|
|
126
|
+
status: "completed" | "cancelled";
|
|
127
|
+
resultMessageId?: string | undefined;
|
|
128
|
+
}[];
|
|
129
|
+
submittedBySessionId: string;
|
|
130
|
+
submittedAt: string;
|
|
131
|
+
artifacts?: {
|
|
132
|
+
path: string;
|
|
133
|
+
sha256: string;
|
|
134
|
+
bytes: number;
|
|
135
|
+
snapshot: true;
|
|
136
|
+
}[] | undefined;
|
|
137
|
+
}[];
|
|
138
|
+
reviews: {
|
|
139
|
+
claimId: string;
|
|
140
|
+
decision: "accept" | "rework";
|
|
141
|
+
reason: string;
|
|
142
|
+
reviewedAt: string;
|
|
143
|
+
reviewedBySessionId?: string | undefined;
|
|
144
|
+
reviewedByPrincipal?: string | undefined;
|
|
145
|
+
}[];
|
|
146
|
+
createdAt: string;
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
driver?: string | undefined;
|
|
149
|
+
seats?: {
|
|
150
|
+
id: string;
|
|
151
|
+
address: string;
|
|
152
|
+
homeAddress: string;
|
|
153
|
+
responsibility: string;
|
|
154
|
+
status: "active" | "released";
|
|
155
|
+
joinedAt: string;
|
|
156
|
+
updatedAt: string;
|
|
157
|
+
releasedAt?: string | undefined;
|
|
158
|
+
}[] | undefined;
|
|
159
|
+
seatEvents?: {
|
|
160
|
+
seatAddress: string;
|
|
161
|
+
homeAddress: string;
|
|
162
|
+
action: "released" | "joined" | "responsibility-updated" | "rejoined";
|
|
163
|
+
responsibility: string;
|
|
164
|
+
bySessionId: string;
|
|
165
|
+
at: string;
|
|
166
|
+
}[] | undefined;
|
|
167
|
+
currentClaimId?: string | undefined;
|
|
168
|
+
acceptedClaimId?: string | undefined;
|
|
169
|
+
}>;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
export declare class ProjectLedger {
|
|
173
|
+
private readonly domain;
|
|
174
|
+
private mutationTail;
|
|
175
|
+
private constructor();
|
|
176
|
+
static open(facility: DomainFacility): Promise<ProjectLedger>;
|
|
177
|
+
withWrite<T>(update: () => Promise<T>): Promise<T>;
|
|
178
|
+
get(id: string): FormalProject | undefined;
|
|
179
|
+
list(): FormalProject[];
|
|
180
|
+
put(project: FormalProject): Promise<void>;
|
|
181
|
+
close(): Promise<void>;
|
|
182
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HomeAddress, ProjectSeatAddress } from './domain.js';
|
|
2
|
+
import type { FormalProject, ProjectSeat } from './project-ledger.js';
|
|
3
|
+
export interface ProjectSeatContext {
|
|
4
|
+
projectId: string;
|
|
5
|
+
projectRevision: number;
|
|
6
|
+
title: string;
|
|
7
|
+
goal: string;
|
|
8
|
+
doneWhen: string;
|
|
9
|
+
status: FormalProject['status'];
|
|
10
|
+
lead: HomeAddress;
|
|
11
|
+
seatAddress: ProjectSeatAddress;
|
|
12
|
+
homeAddress: HomeAddress;
|
|
13
|
+
responsibility: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function projectSeatContext(project: FormalProject, seat: ProjectSeat): ProjectSeatContext;
|
|
16
|
+
/** Situates a Home-bound Session in one Seat without claiming a separate execution identity. */
|
|
17
|
+
export declare function renderProjectSeatContext(context: ProjectSeatContext): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface RegularFileIdentity {
|
|
2
|
+
dev: number;
|
|
3
|
+
ino: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ReadRegularFileOptions {
|
|
6
|
+
/** Reject files larger than this many bytes, checked on the open handle. */
|
|
7
|
+
maxBytes?: number;
|
|
8
|
+
/** Require the opened file to be this exact inode, e.g. one validated by an earlier path check. */
|
|
9
|
+
expected?: RegularFileIdentity;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Read one file without following a final symlink and without a check-then-read race: the file
|
|
13
|
+
* is opened with O_NOFOLLOW (O_NONBLOCK keeps a FIFO from blocking the open), then the open
|
|
14
|
+
* handle is checked to be a regular file and read. Platforms without O_NOFOLLOW fall back to an
|
|
15
|
+
* lstat check plus the same handle checks.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readRegularFileNoFollow(path: string, options?: ReadRegularFileOptions): Promise<Buffer>;
|
|
18
|
+
/**
|
|
19
|
+
* Replace a file so that a crash or power loss leaves either the old or the new contents, never an
|
|
20
|
+
* empty file: write a private temporary file, fsync it, rename it over the target, then fsync the
|
|
21
|
+
* directory so the rename itself is durable (best effort where directories cannot be fsynced).
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeFileDurably(path: string, contents: string | Uint8Array): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CreateOrganizationInput } from './home-store.js';
|
|
2
|
+
/** A small growth team with real data to work on, so every BizAgent loop can be tried in minutes. */
|
|
3
|
+
export declare const SAMPLE_ORGANIZATION: Omit<CreateOrganizationInput, 'owner'>;
|
|
4
|
+
/** Files placed in sample Home directories. Existing files are never overwritten. */
|
|
5
|
+
export declare const SAMPLE_FILES: ReadonlyArray<{
|
|
6
|
+
home: string;
|
|
7
|
+
path: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}>;
|