@mawaru/sdk 0.23.0 → 0.25.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/_schemas/graph.test.ts +22 -5
- package/_schemas/graph.ts +21 -2
- package/dist/_schemas/graph.d.ts +8 -3
- package/dist/_schemas/graph.js +20 -2
- package/package.json +1 -1
package/_schemas/graph.test.ts
CHANGED
|
@@ -160,17 +160,25 @@ describe("aiConfigSchema", () => {
|
|
|
160
160
|
})
|
|
161
161
|
|
|
162
162
|
describe("humanConfigSchema", () => {
|
|
163
|
-
it("
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
it("strategy / approval_mode の既定値を補う(fixed・any)", () => {
|
|
164
|
+
const u1 = uuid()
|
|
165
|
+
expect(humanConfigSchema.parse({ assignment: { units: [[u1]] } })).toEqual({
|
|
166
|
+
assignment: { strategy: "fixed", approval_mode: "any", units: [[u1]] },
|
|
166
167
|
})
|
|
167
168
|
})
|
|
168
169
|
|
|
170
|
+
it("担当なし(units 空・省略)を拒否する(「誰でも」は無い)", () => {
|
|
171
|
+
expect(() => humanConfigSchema.parse({ assignment: {} })).toThrow()
|
|
172
|
+
expect(() =>
|
|
173
|
+
humanConfigSchema.parse({ assignment: { units: [] } }),
|
|
174
|
+
).toThrow(/担当/)
|
|
175
|
+
})
|
|
176
|
+
|
|
169
177
|
// 承認ビューは不透明なキー(program_dir / ai_dir と同じ)。実在するか・そのテナントが
|
|
170
178
|
// 選べるかは mawaru 側のカタログ(非公開)と保存 API が見るので、ここは形だけ
|
|
171
179
|
it("承認ビューを受け付ける", () => {
|
|
172
180
|
const parsed = humanConfigSchema.parse({
|
|
173
|
-
assignment: {},
|
|
181
|
+
assignment: { units: [[uuid()]] },
|
|
174
182
|
view: "acme/invoice",
|
|
175
183
|
})
|
|
176
184
|
expect(parsed.view).toBe("acme/invoice")
|
|
@@ -178,7 +186,7 @@ describe("humanConfigSchema", () => {
|
|
|
178
186
|
|
|
179
187
|
it("空のビューキーは拒否する", () => {
|
|
180
188
|
expect(() =>
|
|
181
|
-
humanConfigSchema.parse({ assignment: {}, view: "" }),
|
|
189
|
+
humanConfigSchema.parse({ assignment: { units: [[uuid()]] }, view: "" }),
|
|
182
190
|
).toThrow()
|
|
183
191
|
})
|
|
184
192
|
|
|
@@ -513,6 +521,8 @@ const humanNode = () => ({
|
|
|
513
521
|
port("out", "reject"),
|
|
514
522
|
]),
|
|
515
523
|
kind: "human" as const,
|
|
524
|
+
// 担当は必須(「担当なし=誰でも」は無い)
|
|
525
|
+
human: { assignment: { units: [[uuid()]] } },
|
|
516
526
|
})
|
|
517
527
|
const aiNode = () => ({
|
|
518
528
|
...makeNode([
|
|
@@ -538,6 +548,13 @@ const outByKey = (node: TestNode, key: string): GraphPort => {
|
|
|
538
548
|
}
|
|
539
549
|
|
|
540
550
|
describe("saveGraphBodySchema(kind 別ポート構成)", () => {
|
|
551
|
+
it("human の担当なし(human 設定の省略)を拒否する", () => {
|
|
552
|
+
const { human: _human, ...noAssign } = humanNode()
|
|
553
|
+
expect(() =>
|
|
554
|
+
saveGraphBodySchema.parse({ nodes: [noAssign], connections: [] }),
|
|
555
|
+
).toThrow(/担当/)
|
|
556
|
+
})
|
|
557
|
+
|
|
541
558
|
it("human の旧 ok/ng 構成を拒否し、in/approve/reject を受け付ける", () => {
|
|
542
559
|
expect(() =>
|
|
543
560
|
saveGraphBodySchema.parse({ nodes: [humanNode()], connections: [] }),
|
package/_schemas/graph.ts
CHANGED
|
@@ -135,7 +135,8 @@ export type AssignMember = z.infer<typeof assignMemberSchema>
|
|
|
135
135
|
|
|
136
136
|
// Human ノードの kind 別設定(node_humans + node_human_assignees に対応)。
|
|
137
137
|
// 担当 = ユニット(1人以上のメンバー)の順序付きリスト + 承認モード + 選出戦略。
|
|
138
|
-
// units[i] はメンバーの配列(1
|
|
138
|
+
// units[i] はメンバーの配列(1人=個人・複数=グループ)。**担当は必ず明示する**
|
|
139
|
+
// (「担当なし=tenant の誰でも」は無い。Human担当の必須化(誰でもの廃止).md)。
|
|
139
140
|
// approval_mode はノード単位(any=誰か1人 / all=全員。差し戻しは1人で成立=veto)。
|
|
140
141
|
// メンバーが tenant の membership であることの検証は保存 API 側で行う
|
|
141
142
|
// (docs/tasks/backlog/Human担当者の高度化(複数人承認とラウンドロビン).md)
|
|
@@ -148,7 +149,9 @@ export const humanConfigSchema = z.object({
|
|
|
148
149
|
.object({
|
|
149
150
|
strategy: z.enum(["fixed", "round_robin"]).default("fixed"),
|
|
150
151
|
approval_mode: z.enum(["any", "all"]).default("any"),
|
|
151
|
-
units: z
|
|
152
|
+
units: z
|
|
153
|
+
.array(z.array(assignMemberSchema).min(1))
|
|
154
|
+
.min(1, "担当を1人以上指定してください"),
|
|
152
155
|
})
|
|
153
156
|
.superRefine((assignment, ctx) => {
|
|
154
157
|
if (assignment.strategy === "fixed" && assignment.units.length > 1) {
|
|
@@ -199,6 +202,9 @@ export type HumanConfig = z.infer<typeof humanConfigSchema>
|
|
|
199
202
|
// (docs/tasks/done/コンポーネント(ループの部品化と再利用).md)
|
|
200
203
|
export const componentConfigSchema = z.object({
|
|
201
204
|
component_loop_id: z.uuid(),
|
|
205
|
+
// 親が pin する子の版。省略=子の最新 published(グループは owner の draft と対)。
|
|
206
|
+
// 版管理(draftとpublish).md
|
|
207
|
+
component_loop_version_id: z.uuid().optional(),
|
|
202
208
|
// 配置の設定値:子 loop の refs 定義(default/required)への上書き。
|
|
203
209
|
// 子 run 起動時の起動時指定として渡る(省略=上書きなし。検証は保存 API と
|
|
204
210
|
// 起動時の mergeRefs が行う。コンポーネントの設定値(refs)と1ノードのコンポーネント化.md)
|
|
@@ -259,7 +265,10 @@ export const NODE_ICON_PRESETS = [
|
|
|
259
265
|
export type NodeIconPresetKey = (typeof NODE_ICON_PRESETS)[number]["key"]
|
|
260
266
|
|
|
261
267
|
export const graphNodeSchema = z.object({
|
|
268
|
+
// 版の行 id(新規ノードは client 採番)。既存ノードの突き合わせは node_key で行う
|
|
262
269
|
id: z.uuid(),
|
|
270
|
+
// 版を跨いだ「同一ノード」の識別子。省略=新規ノード(サーバーが発行)
|
|
271
|
+
node_key: z.uuid().optional(),
|
|
263
272
|
kind: graphNodeKindSchema,
|
|
264
273
|
name: z.string().min(1),
|
|
265
274
|
ports: z.array(graphPortSchema),
|
|
@@ -397,6 +406,16 @@ export const saveGraphBodySchema = z
|
|
|
397
406
|
hookDirs.add(hook.hook_dir)
|
|
398
407
|
})
|
|
399
408
|
|
|
409
|
+
// human は担当を必ず明示する(「担当なし=tenant の誰でも」は無い。
|
|
410
|
+
// Human担当の必須化(誰でもの廃止).md)
|
|
411
|
+
if (node.kind === "human" && node.human === undefined) {
|
|
412
|
+
ctx.addIssue({
|
|
413
|
+
code: "custom",
|
|
414
|
+
path: ["nodes", i, "human"],
|
|
415
|
+
message: "human ノードには担当(assignment.units)が必要です",
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
|
|
400
419
|
// component は参照先が無いと成立しない(他 kind の設定はデフォルトで補えるが
|
|
401
420
|
// component_loop_id は補えない)
|
|
402
421
|
if (node.kind === "component" && node.component === undefined) {
|
package/dist/_schemas/graph.d.ts
CHANGED
|
@@ -58,12 +58,13 @@ export declare const humanConfigSchema: z.ZodObject<{
|
|
|
58
58
|
any: "any";
|
|
59
59
|
all: "all";
|
|
60
60
|
}>>;
|
|
61
|
-
units: z.
|
|
61
|
+
units: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodUUID, z.ZodLiteral<"run_starter">]>>>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
63
|
}, z.core.$strip>;
|
|
64
64
|
export type HumanConfig = z.infer<typeof humanConfigSchema>;
|
|
65
65
|
export declare const componentConfigSchema: z.ZodObject<{
|
|
66
66
|
component_loop_id: z.ZodUUID;
|
|
67
|
+
component_loop_version_id: z.ZodOptional<z.ZodUUID>;
|
|
67
68
|
refs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
68
69
|
}, z.core.$strip>;
|
|
69
70
|
export type ComponentConfig = z.infer<typeof componentConfigSchema>;
|
|
@@ -126,6 +127,7 @@ export declare const NODE_ICON_PRESETS: readonly [{
|
|
|
126
127
|
export type NodeIconPresetKey = (typeof NODE_ICON_PRESETS)[number]["key"];
|
|
127
128
|
export declare const graphNodeSchema: z.ZodObject<{
|
|
128
129
|
id: z.ZodUUID;
|
|
130
|
+
node_key: z.ZodOptional<z.ZodUUID>;
|
|
129
131
|
kind: z.ZodEnum<{
|
|
130
132
|
start: "start";
|
|
131
133
|
ai: "ai";
|
|
@@ -197,11 +199,12 @@ export declare const graphNodeSchema: z.ZodObject<{
|
|
|
197
199
|
any: "any";
|
|
198
200
|
all: "all";
|
|
199
201
|
}>>;
|
|
200
|
-
units: z.
|
|
202
|
+
units: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodUUID, z.ZodLiteral<"run_starter">]>>>;
|
|
201
203
|
}, z.core.$strip>;
|
|
202
204
|
}, z.core.$strip>>;
|
|
203
205
|
component: z.ZodOptional<z.ZodObject<{
|
|
204
206
|
component_loop_id: z.ZodUUID;
|
|
207
|
+
component_loop_version_id: z.ZodOptional<z.ZodUUID>;
|
|
205
208
|
refs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
206
209
|
}, z.core.$strip>>;
|
|
207
210
|
}, z.core.$strip>;
|
|
@@ -223,6 +226,7 @@ export type GraphConnection = z.infer<typeof graphConnectionSchema>;
|
|
|
223
226
|
export declare const saveGraphBodySchema: z.ZodObject<{
|
|
224
227
|
nodes: z.ZodArray<z.ZodObject<{
|
|
225
228
|
id: z.ZodUUID;
|
|
229
|
+
node_key: z.ZodOptional<z.ZodUUID>;
|
|
226
230
|
kind: z.ZodEnum<{
|
|
227
231
|
start: "start";
|
|
228
232
|
ai: "ai";
|
|
@@ -294,11 +298,12 @@ export declare const saveGraphBodySchema: z.ZodObject<{
|
|
|
294
298
|
any: "any";
|
|
295
299
|
all: "all";
|
|
296
300
|
}>>;
|
|
297
|
-
units: z.
|
|
301
|
+
units: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodUUID, z.ZodLiteral<"run_starter">]>>>;
|
|
298
302
|
}, z.core.$strip>;
|
|
299
303
|
}, z.core.$strip>>;
|
|
300
304
|
component: z.ZodOptional<z.ZodObject<{
|
|
301
305
|
component_loop_id: z.ZodUUID;
|
|
306
|
+
component_loop_version_id: z.ZodOptional<z.ZodUUID>;
|
|
302
307
|
refs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
303
308
|
}, z.core.$strip>>;
|
|
304
309
|
}, z.core.$strip>>;
|
package/dist/_schemas/graph.js
CHANGED
|
@@ -96,7 +96,8 @@ export const RUN_STARTER = "run_starter";
|
|
|
96
96
|
export const assignMemberSchema = z.union([z.uuid(), z.literal(RUN_STARTER)]);
|
|
97
97
|
// Human ノードの kind 別設定(node_humans + node_human_assignees に対応)。
|
|
98
98
|
// 担当 = ユニット(1人以上のメンバー)の順序付きリスト + 承認モード + 選出戦略。
|
|
99
|
-
// units[i] はメンバーの配列(1
|
|
99
|
+
// units[i] はメンバーの配列(1人=個人・複数=グループ)。**担当は必ず明示する**
|
|
100
|
+
// (「担当なし=tenant の誰でも」は無い。Human担当の必須化(誰でもの廃止).md)。
|
|
100
101
|
// approval_mode はノード単位(any=誰か1人 / all=全員。差し戻しは1人で成立=veto)。
|
|
101
102
|
// メンバーが tenant の membership であることの検証は保存 API 側で行う
|
|
102
103
|
// (docs/tasks/backlog/Human担当者の高度化(複数人承認とラウンドロビン).md)
|
|
@@ -109,7 +110,9 @@ export const humanConfigSchema = z.object({
|
|
|
109
110
|
.object({
|
|
110
111
|
strategy: z.enum(["fixed", "round_robin"]).default("fixed"),
|
|
111
112
|
approval_mode: z.enum(["any", "all"]).default("any"),
|
|
112
|
-
units: z
|
|
113
|
+
units: z
|
|
114
|
+
.array(z.array(assignMemberSchema).min(1))
|
|
115
|
+
.min(1, "担当を1人以上指定してください"),
|
|
113
116
|
})
|
|
114
117
|
.superRefine((assignment, ctx) => {
|
|
115
118
|
if (assignment.strategy === "fixed" && assignment.units.length > 1) {
|
|
@@ -154,6 +157,9 @@ export const humanConfigSchema = z.object({
|
|
|
154
157
|
// (docs/tasks/done/コンポーネント(ループの部品化と再利用).md)
|
|
155
158
|
export const componentConfigSchema = z.object({
|
|
156
159
|
component_loop_id: z.uuid(),
|
|
160
|
+
// 親が pin する子の版。省略=子の最新 published(グループは owner の draft と対)。
|
|
161
|
+
// 版管理(draftとpublish).md
|
|
162
|
+
component_loop_version_id: z.uuid().optional(),
|
|
157
163
|
// 配置の設定値:子 loop の refs 定義(default/required)への上書き。
|
|
158
164
|
// 子 run 起動時の起動時指定として渡る(省略=上書きなし。検証は保存 API と
|
|
159
165
|
// 起動時の mergeRefs が行う。コンポーネントの設定値(refs)と1ノードのコンポーネント化.md)
|
|
@@ -203,7 +209,10 @@ export const NODE_ICON_PRESETS = [
|
|
|
203
209
|
{ key: "sentry", name: "Sentry" },
|
|
204
210
|
];
|
|
205
211
|
export const graphNodeSchema = z.object({
|
|
212
|
+
// 版の行 id(新規ノードは client 採番)。既存ノードの突き合わせは node_key で行う
|
|
206
213
|
id: z.uuid(),
|
|
214
|
+
// 版を跨いだ「同一ノード」の識別子。省略=新規ノード(サーバーが発行)
|
|
215
|
+
node_key: z.uuid().optional(),
|
|
207
216
|
kind: graphNodeKindSchema,
|
|
208
217
|
name: z.string().min(1),
|
|
209
218
|
ports: z.array(graphPortSchema),
|
|
@@ -329,6 +338,15 @@ export const saveGraphBodySchema = z
|
|
|
329
338
|
}
|
|
330
339
|
hookDirs.add(hook.hook_dir);
|
|
331
340
|
});
|
|
341
|
+
// human は担当を必ず明示する(「担当なし=tenant の誰でも」は無い。
|
|
342
|
+
// Human担当の必須化(誰でもの廃止).md)
|
|
343
|
+
if (node.kind === "human" && node.human === undefined) {
|
|
344
|
+
ctx.addIssue({
|
|
345
|
+
code: "custom",
|
|
346
|
+
path: ["nodes", i, "human"],
|
|
347
|
+
message: "human ノードには担当(assignment.units)が必要です",
|
|
348
|
+
});
|
|
349
|
+
}
|
|
332
350
|
// component は参照先が無いと成立しない(他 kind の設定はデフォルトで補えるが
|
|
333
351
|
// component_loop_id は補えない)
|
|
334
352
|
if (node.kind === "component" && node.component === undefined) {
|