@asc-agent/runtime 0.1.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/LICENSE +15 -0
- package/README.md +22 -0
- package/dist/adapters/claude-code/binding.d.ts +5 -0
- package/dist/adapters/claude-code/binding.js +14 -0
- package/dist/adapters/claude-code/guard.d.ts +54 -0
- package/dist/adapters/claude-code/guard.js +295 -0
- package/dist/adapters/claude-code/install.d.ts +67 -0
- package/dist/adapters/claude-code/install.js +231 -0
- package/dist/adapters/claude-code/observer.d.ts +38 -0
- package/dist/adapters/claude-code/observer.js +77 -0
- package/dist/adapters/claude-code/probe.d.ts +53 -0
- package/dist/adapters/claude-code/probe.js +129 -0
- package/dist/adapters/claude-code/skill.d.ts +8 -0
- package/dist/adapters/claude-code/skill.js +267 -0
- package/dist/adapters/fixture-work/index.d.ts +34 -0
- package/dist/adapters/fixture-work/index.js +78 -0
- package/dist/adapters/github/adapter.d.ts +32 -0
- package/dist/adapters/github/adapter.js +95 -0
- package/dist/adapters/github/client.d.ts +30 -0
- package/dist/adapters/github/client.js +90 -0
- package/dist/adapters/github/context.d.ts +44 -0
- package/dist/adapters/github/context.js +170 -0
- package/dist/adapters/github/event-source.d.ts +55 -0
- package/dist/adapters/github/event-source.js +183 -0
- package/dist/adapters/github/scm.d.ts +50 -0
- package/dist/adapters/github/scm.js +104 -0
- package/dist/adapters/gitlab/adapter.d.ts +36 -0
- package/dist/adapters/gitlab/adapter.js +117 -0
- package/dist/adapters/gitlab/client.d.ts +30 -0
- package/dist/adapters/gitlab/client.js +47 -0
- package/dist/adapters/gitlab/ports.d.ts +40 -0
- package/dist/adapters/gitlab/ports.js +186 -0
- package/dist/adapters/jam/adapter.d.ts +53 -0
- package/dist/adapters/jam/adapter.js +144 -0
- package/dist/adapters/jam/event-source.d.ts +28 -0
- package/dist/adapters/jam/event-source.js +65 -0
- package/dist/adapters/jam/mcp-client.d.ts +50 -0
- package/dist/adapters/jam/mcp-client.js +218 -0
- package/dist/adapters/jam/ports.d.ts +51 -0
- package/dist/adapters/jam/ports.js +167 -0
- package/dist/adapters/local/identity.d.ts +27 -0
- package/dist/adapters/local/identity.js +40 -0
- package/dist/adapters/local/presentation.d.ts +14 -0
- package/dist/adapters/local/presentation.js +42 -0
- package/dist/adapters/markdown/layout.d.ts +15 -0
- package/dist/adapters/markdown/layout.js +49 -0
- package/dist/adapters/markdown/serialize.d.ts +9 -0
- package/dist/adapters/markdown/serialize.js +120 -0
- package/dist/adapters/markdown/state-store.d.ts +23 -0
- package/dist/adapters/markdown/state-store.js +316 -0
- package/dist/adapters/mattermost/client.d.ts +23 -0
- package/dist/adapters/mattermost/client.js +54 -0
- package/dist/adapters/mattermost/presentation.d.ts +43 -0
- package/dist/adapters/mattermost/presentation.js +88 -0
- package/dist/adapters/memory/mocks.d.ts +87 -0
- package/dist/adapters/memory/mocks.js +163 -0
- package/dist/adapters/memory/runtime-binding.d.ts +23 -0
- package/dist/adapters/memory/runtime-binding.js +118 -0
- package/dist/adapters/memory/state-store.d.ts +17 -0
- package/dist/adapters/memory/state-store.js +125 -0
- package/dist/adapters/text/renderer.d.ts +7 -0
- package/dist/adapters/text/renderer.js +81 -0
- package/dist/adapters/webhook/ingress.d.ts +103 -0
- package/dist/adapters/webhook/ingress.js +150 -0
- package/dist/cli/asc.d.ts +16 -0
- package/dist/cli/asc.js +2914 -0
- package/dist/cli/identity-config.d.ts +7 -0
- package/dist/cli/identity-config.js +31 -0
- package/dist/composition/observe.d.ts +21 -0
- package/dist/composition/observe.js +72 -0
- package/dist/composition/registry.d.ts +33 -0
- package/dist/composition/registry.js +62 -0
- package/dist/composition/runtime.d.ts +63 -0
- package/dist/composition/runtime.js +155 -0
- package/dist/core/approval/service.d.ts +17 -0
- package/dist/core/approval/service.js +129 -0
- package/dist/core/attach/bootstrap.d.ts +102 -0
- package/dist/core/attach/bootstrap.js +178 -0
- package/dist/core/attach/init.d.ts +29 -0
- package/dist/core/attach/init.js +100 -0
- package/dist/core/attach/setup-plan.d.ts +125 -0
- package/dist/core/attach/setup-plan.js +177 -0
- package/dist/core/attach/setup.d.ts +40 -0
- package/dist/core/attach/setup.js +140 -0
- package/dist/core/binding/types.d.ts +93 -0
- package/dist/core/binding/types.js +74 -0
- package/dist/core/distribution/release.d.ts +15 -0
- package/dist/core/distribution/release.js +27 -0
- package/dist/core/distribution/runtime-install.d.ts +50 -0
- package/dist/core/distribution/runtime-install.js +90 -0
- package/dist/core/distribution/runtime-select.d.ts +74 -0
- package/dist/core/distribution/runtime-select.js +149 -0
- package/dist/core/execution/executor.d.ts +51 -0
- package/dist/core/execution/executor.js +106 -0
- package/dist/core/execution/grant.d.ts +42 -0
- package/dist/core/execution/grant.js +78 -0
- package/dist/core/model/entities.d.ts +872 -0
- package/dist/core/model/entities.js +285 -0
- package/dist/core/model/ids.d.ts +41 -0
- package/dist/core/model/ids.js +50 -0
- package/dist/core/model/transitions.d.ts +26 -0
- package/dist/core/model/transitions.js +124 -0
- package/dist/core/monitor/coverage.d.ts +111 -0
- package/dist/core/monitor/coverage.js +129 -0
- package/dist/core/monitor/engine.d.ts +134 -0
- package/dist/core/monitor/engine.js +574 -0
- package/dist/core/monitor/health-alerts.d.ts +35 -0
- package/dist/core/monitor/health-alerts.js +88 -0
- package/dist/core/monitor/investigation.d.ts +82 -0
- package/dist/core/monitor/investigation.js +232 -0
- package/dist/core/monitor/observation.d.ts +79 -0
- package/dist/core/monitor/observation.js +110 -0
- package/dist/core/monitor/relevance.d.ts +47 -0
- package/dist/core/monitor/relevance.js +100 -0
- package/dist/core/monitor/signals.d.ts +59 -0
- package/dist/core/monitor/signals.js +105 -0
- package/dist/core/operator/local-operator.d.ts +60 -0
- package/dist/core/operator/local-operator.js +82 -0
- package/dist/core/operator/preflight.d.ts +60 -0
- package/dist/core/operator/preflight.js +139 -0
- package/dist/core/operator/proceed.d.ts +98 -0
- package/dist/core/operator/proceed.js +167 -0
- package/dist/core/operator/progress.d.ts +124 -0
- package/dist/core/operator/progress.js +135 -0
- package/dist/core/operator/render.d.ts +34 -0
- package/dist/core/operator/render.js +170 -0
- package/dist/core/operator/runtime-binding.d.ts +61 -0
- package/dist/core/operator/runtime-binding.js +22 -0
- package/dist/core/policy/ownership.d.ts +44 -0
- package/dist/core/policy/ownership.js +46 -0
- package/dist/core/policy/policy.d.ts +99 -0
- package/dist/core/policy/policy.js +147 -0
- package/dist/core/policy/remote-freeze.d.ts +101 -0
- package/dist/core/policy/remote-freeze.js +151 -0
- package/dist/core/policy/scope.d.ts +23 -0
- package/dist/core/policy/scope.js +93 -0
- package/dist/core/presentation/digest.d.ts +98 -0
- package/dist/core/presentation/digest.js +160 -0
- package/dist/core/resolver/load.d.ts +121 -0
- package/dist/core/resolver/load.js +246 -0
- package/dist/core/resolver/render.d.ts +4 -0
- package/dist/core/resolver/render.js +62 -0
- package/dist/core/resolver/resolve.d.ts +42 -0
- package/dist/core/resolver/resolve.js +51 -0
- package/dist/core/resolver/version.d.ts +22 -0
- package/dist/core/resolver/version.js +49 -0
- package/dist/core/runtime/audit.d.ts +374 -0
- package/dist/core/runtime/audit.js +454 -0
- package/dist/core/runtime/claims.d.ts +115 -0
- package/dist/core/runtime/claims.js +153 -0
- package/dist/core/runtime/closure.d.ts +73 -0
- package/dist/core/runtime/closure.js +162 -0
- package/dist/core/runtime/controller.d.ts +40 -0
- package/dist/core/runtime/controller.js +121 -0
- package/dist/core/runtime/escalation.d.ts +188 -0
- package/dist/core/runtime/escalation.js +322 -0
- package/dist/core/runtime/execution-state.d.ts +43 -0
- package/dist/core/runtime/execution-state.js +81 -0
- package/dist/core/runtime/front.d.ts +95 -0
- package/dist/core/runtime/front.js +144 -0
- package/dist/core/runtime/orchestrator.d.ts +54 -0
- package/dist/core/runtime/orchestrator.js +98 -0
- package/dist/core/runtime/query.d.ts +184 -0
- package/dist/core/runtime/query.js +213 -0
- package/dist/core/runtime/report.d.ts +33 -0
- package/dist/core/runtime/report.js +108 -0
- package/dist/core/runtime/session.d.ts +156 -0
- package/dist/core/runtime/session.js +281 -0
- package/dist/core/runtime/store-ops.d.ts +22 -0
- package/dist/core/runtime/store-ops.js +26 -0
- package/dist/core/view/build-view.d.ts +36 -0
- package/dist/core/view/build-view.js +131 -0
- package/dist/core/view/decision-view.d.ts +564 -0
- package/dist/core/view/decision-view.js +103 -0
- package/dist/core/workspace/identity.d.ts +82 -0
- package/dist/core/workspace/identity.js +133 -0
- package/dist/core/workspace/index-store.d.ts +140 -0
- package/dist/core/workspace/index-store.js +125 -0
- package/dist/core/workspace/migrate.d.ts +73 -0
- package/dist/core/workspace/migrate.js +123 -0
- package/dist/core/workspace/resolve.d.ts +34 -0
- package/dist/core/workspace/resolve.js +89 -0
- package/dist/ports/adapter.d.ts +35 -0
- package/dist/ports/adapter.js +12 -0
- package/dist/ports/approval.d.ts +98 -0
- package/dist/ports/approval.js +7 -0
- package/dist/ports/change-context.d.ts +22 -0
- package/dist/ports/change-context.js +8 -0
- package/dist/ports/event-source.d.ts +42 -0
- package/dist/ports/event-source.js +6 -0
- package/dist/ports/inventory.d.ts +53 -0
- package/dist/ports/inventory.js +12 -0
- package/dist/ports/presentation.d.ts +62 -0
- package/dist/ports/presentation.js +13 -0
- package/dist/ports/renderer.d.ts +23 -0
- package/dist/ports/renderer.js +7 -0
- package/dist/ports/resource-context.d.ts +51 -0
- package/dist/ports/resource-context.js +9 -0
- package/dist/ports/scm.d.ts +40 -0
- package/dist/ports/scm.js +6 -0
- package/dist/ports/state-store.d.ts +97 -0
- package/dist/ports/state-store.js +12 -0
- package/dist/presets/balanced.json +8 -0
- package/dist/presets/conservative.json +9 -0
- package/dist/presets/lightweight.json +8 -0
- package/dist/profiles/example-team/profile.json +101 -0
- package/dist/profiles/pilot-local/profile.json +56 -0
- package/dist/schemas/profile.d.ts +631 -0
- package/dist/schemas/profile.js +287 -0
- package/package.json +55 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* 조회 시점 기준으로 이 요청이 얼마나 신선한지 (C-01 §7).
|
|
4
|
+
* 사용성·사전 경고 장치이며, 게시 직전 Drift Guard(OM §11.9)를 대체하지 않는다 —
|
|
5
|
+
* CURRENT로 보였더라도 Executor는 실행 직전 대상 상태를 다시 확인한다.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Freshness: z.ZodEnum<["CURRENT", "STALE_CONTEXT", "SOURCE_CHANGED", "ALREADY_DECIDED"]>;
|
|
8
|
+
export type Freshness = z.infer<typeof Freshness>;
|
|
9
|
+
/**
|
|
10
|
+
* 무엇을 실제로 확인했는지. `CURRENT`는 "변화 없음"이 아니라 "확인할 수 있었던 범위에서
|
|
11
|
+
* 변화 없음"이고, 그 범위가 어디까지였는지는 여기서만 알 수 있다.
|
|
12
|
+
* 이 구분이 없으면 외부 연결이 끊긴 채 조회한 결과와 정말로 조용한 요청이 똑같아 보인다.
|
|
13
|
+
*/
|
|
14
|
+
export declare const VerificationStatus: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
15
|
+
export type VerificationStatus = z.infer<typeof VerificationStatus>;
|
|
16
|
+
export declare const VerificationCoverage: z.ZodObject<{
|
|
17
|
+
/** 활성 세션·Controller 상태 대조. */
|
|
18
|
+
localContext: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
19
|
+
/** 스레드 최신 이벤트와 canonical baseline 대조 — 외부 연결이 있어야 한다. */
|
|
20
|
+
source: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
23
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
24
|
+
}, {
|
|
25
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
26
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
27
|
+
}>;
|
|
28
|
+
export type VerificationCoverage = z.infer<typeof VerificationCoverage>;
|
|
29
|
+
/**
|
|
30
|
+
* 요청 생성 당시의 분석. ApprovalRequest 원본에서 그대로 온 불변 값이다 (C-01 §6-A).
|
|
31
|
+
* 조회 시점의 현재 사실처럼 제시하면 안 된다.
|
|
32
|
+
*/
|
|
33
|
+
export declare const StoredPacket: z.ZodObject<{
|
|
34
|
+
status: z.ZodEnum<["AWAITING_APPROVAL", "APPROVED", "QUEUED", "DEFERRED", "DISMISSED", "DONE"]>;
|
|
35
|
+
type: z.ZodEnum<["informational", "actionable", "work"]>;
|
|
36
|
+
priority: z.ZodEnum<["P0", "P1", "P2"]>;
|
|
37
|
+
title: z.ZodString;
|
|
38
|
+
detectedAt: z.ZodString;
|
|
39
|
+
source: z.ZodString;
|
|
40
|
+
situation: z.ZodString;
|
|
41
|
+
context: z.ZodString;
|
|
42
|
+
interruptRequired: z.ZodBoolean;
|
|
43
|
+
affectedSessions: z.ZodArray<z.ZodString, "many">;
|
|
44
|
+
rationale: z.ZodString;
|
|
45
|
+
recommendation: z.ZodString;
|
|
46
|
+
draft: z.ZodOptional<z.ZodString>;
|
|
47
|
+
snapshot: z.ZodArray<z.ZodObject<{
|
|
48
|
+
sourceId: z.ZodString;
|
|
49
|
+
baseline: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
sourceId: string;
|
|
52
|
+
baseline: string;
|
|
53
|
+
}, {
|
|
54
|
+
sourceId: string;
|
|
55
|
+
baseline: string;
|
|
56
|
+
}>, "many">;
|
|
57
|
+
threadLastEventId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
type: "informational" | "actionable" | "work";
|
|
60
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
61
|
+
snapshot: {
|
|
62
|
+
sourceId: string;
|
|
63
|
+
baseline: string;
|
|
64
|
+
}[];
|
|
65
|
+
priority: "P0" | "P1" | "P2";
|
|
66
|
+
title: string;
|
|
67
|
+
detectedAt: string;
|
|
68
|
+
source: string;
|
|
69
|
+
situation: string;
|
|
70
|
+
context: string;
|
|
71
|
+
interruptRequired: boolean;
|
|
72
|
+
affectedSessions: string[];
|
|
73
|
+
rationale: string;
|
|
74
|
+
recommendation: string;
|
|
75
|
+
threadLastEventId?: string | undefined;
|
|
76
|
+
draft?: string | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
type: "informational" | "actionable" | "work";
|
|
79
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
80
|
+
snapshot: {
|
|
81
|
+
sourceId: string;
|
|
82
|
+
baseline: string;
|
|
83
|
+
}[];
|
|
84
|
+
priority: "P0" | "P1" | "P2";
|
|
85
|
+
title: string;
|
|
86
|
+
detectedAt: string;
|
|
87
|
+
source: string;
|
|
88
|
+
situation: string;
|
|
89
|
+
context: string;
|
|
90
|
+
interruptRequired: boolean;
|
|
91
|
+
affectedSessions: string[];
|
|
92
|
+
rationale: string;
|
|
93
|
+
recommendation: string;
|
|
94
|
+
threadLastEventId?: string | undefined;
|
|
95
|
+
draft?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
export type StoredPacket = z.infer<typeof StoredPacket>;
|
|
98
|
+
/**
|
|
99
|
+
* 조회 시점에 state·controller·Active Session·Canonical을 다시 읽어 만든 파생 정보
|
|
100
|
+
* (C-01 §6-B). Derived View다 — 원본을 덮어쓰지 않고 History도 건드리지 않는다.
|
|
101
|
+
* 조회 환경이 이 정보를 만들 수 없으면 통째로 생략한다 (undefined).
|
|
102
|
+
*/
|
|
103
|
+
export declare const CurrentContextOverlay: z.ZodObject<{
|
|
104
|
+
observedAt: z.ZodString;
|
|
105
|
+
activeSessions: z.ZodArray<z.ZodString, "many">;
|
|
106
|
+
/** 생성 당시 판단과 달라졌는가 — Stored의 interruptRequired와 대비해 보여준다. */
|
|
107
|
+
affectsCurrentWork: z.ZodBoolean;
|
|
108
|
+
/** source별 baseline 변화. before가 없으면 요청이 그 source를 기록하지 않은 것이다. */
|
|
109
|
+
canonicalChanges: z.ZodArray<z.ZodObject<{
|
|
110
|
+
sourceId: z.ZodString;
|
|
111
|
+
before: z.ZodOptional<z.ZodString>;
|
|
112
|
+
after: z.ZodString;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
sourceId: string;
|
|
115
|
+
after: string;
|
|
116
|
+
before?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
sourceId: string;
|
|
119
|
+
after: string;
|
|
120
|
+
before?: string | undefined;
|
|
121
|
+
}>, "many">;
|
|
122
|
+
notes: z.ZodArray<z.ZodString, "many">;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
activeSessions: string[];
|
|
125
|
+
observedAt: string;
|
|
126
|
+
affectsCurrentWork: boolean;
|
|
127
|
+
canonicalChanges: {
|
|
128
|
+
sourceId: string;
|
|
129
|
+
after: string;
|
|
130
|
+
before?: string | undefined;
|
|
131
|
+
}[];
|
|
132
|
+
notes: string[];
|
|
133
|
+
}, {
|
|
134
|
+
activeSessions: string[];
|
|
135
|
+
observedAt: string;
|
|
136
|
+
affectsCurrentWork: boolean;
|
|
137
|
+
canonicalChanges: {
|
|
138
|
+
sourceId: string;
|
|
139
|
+
after: string;
|
|
140
|
+
before?: string | undefined;
|
|
141
|
+
}[];
|
|
142
|
+
notes: string[];
|
|
143
|
+
}>;
|
|
144
|
+
export type CurrentContextOverlay = z.infer<typeof CurrentContextOverlay>;
|
|
145
|
+
/**
|
|
146
|
+
* 전 채널 공통 view. `reference`는 어느 표현에서도 숨기지 않는다 — 사용자가 MM에서 본
|
|
147
|
+
* 요청을 로컬에서 그대로 지목할 수 있어야 하기 때문이다 (C-01 §2).
|
|
148
|
+
*/
|
|
149
|
+
export declare const DecisionView: z.ZodObject<{
|
|
150
|
+
requestId: z.ZodString;
|
|
151
|
+
/** 복사 가능한 표시용 참조 — "ASC · P0 · REQ-0042 · Issue #19". */
|
|
152
|
+
reference: z.ZodString;
|
|
153
|
+
version: z.ZodNumber;
|
|
154
|
+
stored: z.ZodObject<{
|
|
155
|
+
status: z.ZodEnum<["AWAITING_APPROVAL", "APPROVED", "QUEUED", "DEFERRED", "DISMISSED", "DONE"]>;
|
|
156
|
+
type: z.ZodEnum<["informational", "actionable", "work"]>;
|
|
157
|
+
priority: z.ZodEnum<["P0", "P1", "P2"]>;
|
|
158
|
+
title: z.ZodString;
|
|
159
|
+
detectedAt: z.ZodString;
|
|
160
|
+
source: z.ZodString;
|
|
161
|
+
situation: z.ZodString;
|
|
162
|
+
context: z.ZodString;
|
|
163
|
+
interruptRequired: z.ZodBoolean;
|
|
164
|
+
affectedSessions: z.ZodArray<z.ZodString, "many">;
|
|
165
|
+
rationale: z.ZodString;
|
|
166
|
+
recommendation: z.ZodString;
|
|
167
|
+
draft: z.ZodOptional<z.ZodString>;
|
|
168
|
+
snapshot: z.ZodArray<z.ZodObject<{
|
|
169
|
+
sourceId: z.ZodString;
|
|
170
|
+
baseline: z.ZodString;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
sourceId: string;
|
|
173
|
+
baseline: string;
|
|
174
|
+
}, {
|
|
175
|
+
sourceId: string;
|
|
176
|
+
baseline: string;
|
|
177
|
+
}>, "many">;
|
|
178
|
+
threadLastEventId: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
type: "informational" | "actionable" | "work";
|
|
181
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
182
|
+
snapshot: {
|
|
183
|
+
sourceId: string;
|
|
184
|
+
baseline: string;
|
|
185
|
+
}[];
|
|
186
|
+
priority: "P0" | "P1" | "P2";
|
|
187
|
+
title: string;
|
|
188
|
+
detectedAt: string;
|
|
189
|
+
source: string;
|
|
190
|
+
situation: string;
|
|
191
|
+
context: string;
|
|
192
|
+
interruptRequired: boolean;
|
|
193
|
+
affectedSessions: string[];
|
|
194
|
+
rationale: string;
|
|
195
|
+
recommendation: string;
|
|
196
|
+
threadLastEventId?: string | undefined;
|
|
197
|
+
draft?: string | undefined;
|
|
198
|
+
}, {
|
|
199
|
+
type: "informational" | "actionable" | "work";
|
|
200
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
201
|
+
snapshot: {
|
|
202
|
+
sourceId: string;
|
|
203
|
+
baseline: string;
|
|
204
|
+
}[];
|
|
205
|
+
priority: "P0" | "P1" | "P2";
|
|
206
|
+
title: string;
|
|
207
|
+
detectedAt: string;
|
|
208
|
+
source: string;
|
|
209
|
+
situation: string;
|
|
210
|
+
context: string;
|
|
211
|
+
interruptRequired: boolean;
|
|
212
|
+
affectedSessions: string[];
|
|
213
|
+
rationale: string;
|
|
214
|
+
recommendation: string;
|
|
215
|
+
threadLastEventId?: string | undefined;
|
|
216
|
+
draft?: string | undefined;
|
|
217
|
+
}>;
|
|
218
|
+
current: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
observedAt: z.ZodString;
|
|
220
|
+
activeSessions: z.ZodArray<z.ZodString, "many">;
|
|
221
|
+
/** 생성 당시 판단과 달라졌는가 — Stored의 interruptRequired와 대비해 보여준다. */
|
|
222
|
+
affectsCurrentWork: z.ZodBoolean;
|
|
223
|
+
/** source별 baseline 변화. before가 없으면 요청이 그 source를 기록하지 않은 것이다. */
|
|
224
|
+
canonicalChanges: z.ZodArray<z.ZodObject<{
|
|
225
|
+
sourceId: z.ZodString;
|
|
226
|
+
before: z.ZodOptional<z.ZodString>;
|
|
227
|
+
after: z.ZodString;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
sourceId: string;
|
|
230
|
+
after: string;
|
|
231
|
+
before?: string | undefined;
|
|
232
|
+
}, {
|
|
233
|
+
sourceId: string;
|
|
234
|
+
after: string;
|
|
235
|
+
before?: string | undefined;
|
|
236
|
+
}>, "many">;
|
|
237
|
+
notes: z.ZodArray<z.ZodString, "many">;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
activeSessions: string[];
|
|
240
|
+
observedAt: string;
|
|
241
|
+
affectsCurrentWork: boolean;
|
|
242
|
+
canonicalChanges: {
|
|
243
|
+
sourceId: string;
|
|
244
|
+
after: string;
|
|
245
|
+
before?: string | undefined;
|
|
246
|
+
}[];
|
|
247
|
+
notes: string[];
|
|
248
|
+
}, {
|
|
249
|
+
activeSessions: string[];
|
|
250
|
+
observedAt: string;
|
|
251
|
+
affectsCurrentWork: boolean;
|
|
252
|
+
canonicalChanges: {
|
|
253
|
+
sourceId: string;
|
|
254
|
+
after: string;
|
|
255
|
+
before?: string | undefined;
|
|
256
|
+
}[];
|
|
257
|
+
notes: string[];
|
|
258
|
+
}>>;
|
|
259
|
+
freshness: z.ZodEnum<["CURRENT", "STALE_CONTEXT", "SOURCE_CHANGED", "ALREADY_DECIDED"]>;
|
|
260
|
+
verification: z.ZodObject<{
|
|
261
|
+
/** 활성 세션·Controller 상태 대조. */
|
|
262
|
+
localContext: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
263
|
+
/** 스레드 최신 이벤트와 canonical baseline 대조 — 외부 연결이 있어야 한다. */
|
|
264
|
+
source: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
267
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
268
|
+
}, {
|
|
269
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
270
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
271
|
+
}>;
|
|
272
|
+
allowedDecisions: z.ZodArray<z.ZodEnum<["approve", "revise", "defer", "dismiss", "queue"]>, "atleastone">;
|
|
273
|
+
authorizedApprover: z.ZodString;
|
|
274
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
275
|
+
/** 이미 결정된 요청이면 그 사실과 결과를 표시한다. */
|
|
276
|
+
decided: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
kind: z.ZodEnum<["approve", "revise", "defer", "dismiss", "queue"]>;
|
|
278
|
+
actor: z.ZodString;
|
|
279
|
+
channel: z.ZodString;
|
|
280
|
+
decidedAt: z.ZodString;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
283
|
+
actor: string;
|
|
284
|
+
channel: string;
|
|
285
|
+
decidedAt: string;
|
|
286
|
+
}, {
|
|
287
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
288
|
+
actor: string;
|
|
289
|
+
channel: string;
|
|
290
|
+
decidedAt: string;
|
|
291
|
+
}>>;
|
|
292
|
+
resultRef: z.ZodOptional<z.ZodString>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
version: number;
|
|
295
|
+
reference: string;
|
|
296
|
+
authorizedApprover: string;
|
|
297
|
+
allowedDecisions: ["approve" | "revise" | "defer" | "dismiss" | "queue", ...("approve" | "revise" | "defer" | "dismiss" | "queue")[]];
|
|
298
|
+
requestId: string;
|
|
299
|
+
stored: {
|
|
300
|
+
type: "informational" | "actionable" | "work";
|
|
301
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
302
|
+
snapshot: {
|
|
303
|
+
sourceId: string;
|
|
304
|
+
baseline: string;
|
|
305
|
+
}[];
|
|
306
|
+
priority: "P0" | "P1" | "P2";
|
|
307
|
+
title: string;
|
|
308
|
+
detectedAt: string;
|
|
309
|
+
source: string;
|
|
310
|
+
situation: string;
|
|
311
|
+
context: string;
|
|
312
|
+
interruptRequired: boolean;
|
|
313
|
+
affectedSessions: string[];
|
|
314
|
+
rationale: string;
|
|
315
|
+
recommendation: string;
|
|
316
|
+
threadLastEventId?: string | undefined;
|
|
317
|
+
draft?: string | undefined;
|
|
318
|
+
};
|
|
319
|
+
freshness: "CURRENT" | "STALE_CONTEXT" | "SOURCE_CHANGED" | "ALREADY_DECIDED";
|
|
320
|
+
verification: {
|
|
321
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
322
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
323
|
+
};
|
|
324
|
+
expiresAt?: string | undefined;
|
|
325
|
+
resultRef?: string | undefined;
|
|
326
|
+
current?: {
|
|
327
|
+
activeSessions: string[];
|
|
328
|
+
observedAt: string;
|
|
329
|
+
affectsCurrentWork: boolean;
|
|
330
|
+
canonicalChanges: {
|
|
331
|
+
sourceId: string;
|
|
332
|
+
after: string;
|
|
333
|
+
before?: string | undefined;
|
|
334
|
+
}[];
|
|
335
|
+
notes: string[];
|
|
336
|
+
} | undefined;
|
|
337
|
+
decided?: {
|
|
338
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
339
|
+
actor: string;
|
|
340
|
+
channel: string;
|
|
341
|
+
decidedAt: string;
|
|
342
|
+
} | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
version: number;
|
|
345
|
+
reference: string;
|
|
346
|
+
authorizedApprover: string;
|
|
347
|
+
allowedDecisions: ["approve" | "revise" | "defer" | "dismiss" | "queue", ...("approve" | "revise" | "defer" | "dismiss" | "queue")[]];
|
|
348
|
+
requestId: string;
|
|
349
|
+
stored: {
|
|
350
|
+
type: "informational" | "actionable" | "work";
|
|
351
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
352
|
+
snapshot: {
|
|
353
|
+
sourceId: string;
|
|
354
|
+
baseline: string;
|
|
355
|
+
}[];
|
|
356
|
+
priority: "P0" | "P1" | "P2";
|
|
357
|
+
title: string;
|
|
358
|
+
detectedAt: string;
|
|
359
|
+
source: string;
|
|
360
|
+
situation: string;
|
|
361
|
+
context: string;
|
|
362
|
+
interruptRequired: boolean;
|
|
363
|
+
affectedSessions: string[];
|
|
364
|
+
rationale: string;
|
|
365
|
+
recommendation: string;
|
|
366
|
+
threadLastEventId?: string | undefined;
|
|
367
|
+
draft?: string | undefined;
|
|
368
|
+
};
|
|
369
|
+
freshness: "CURRENT" | "STALE_CONTEXT" | "SOURCE_CHANGED" | "ALREADY_DECIDED";
|
|
370
|
+
verification: {
|
|
371
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
372
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
373
|
+
};
|
|
374
|
+
expiresAt?: string | undefined;
|
|
375
|
+
resultRef?: string | undefined;
|
|
376
|
+
current?: {
|
|
377
|
+
activeSessions: string[];
|
|
378
|
+
observedAt: string;
|
|
379
|
+
affectsCurrentWork: boolean;
|
|
380
|
+
canonicalChanges: {
|
|
381
|
+
sourceId: string;
|
|
382
|
+
after: string;
|
|
383
|
+
before?: string | undefined;
|
|
384
|
+
}[];
|
|
385
|
+
notes: string[];
|
|
386
|
+
} | undefined;
|
|
387
|
+
decided?: {
|
|
388
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
389
|
+
actor: string;
|
|
390
|
+
channel: string;
|
|
391
|
+
decidedAt: string;
|
|
392
|
+
} | undefined;
|
|
393
|
+
}>;
|
|
394
|
+
export type DecisionView = z.infer<typeof DecisionView>;
|
|
395
|
+
/** 목록 표시용 축약형. 복수 후보를 나열할 때 쓴다 (C-01 §11). */
|
|
396
|
+
export declare const DecisionSummary: z.ZodObject<Pick<{
|
|
397
|
+
requestId: z.ZodString;
|
|
398
|
+
/** 복사 가능한 표시용 참조 — "ASC · P0 · REQ-0042 · Issue #19". */
|
|
399
|
+
reference: z.ZodString;
|
|
400
|
+
version: z.ZodNumber;
|
|
401
|
+
stored: z.ZodObject<{
|
|
402
|
+
status: z.ZodEnum<["AWAITING_APPROVAL", "APPROVED", "QUEUED", "DEFERRED", "DISMISSED", "DONE"]>;
|
|
403
|
+
type: z.ZodEnum<["informational", "actionable", "work"]>;
|
|
404
|
+
priority: z.ZodEnum<["P0", "P1", "P2"]>;
|
|
405
|
+
title: z.ZodString;
|
|
406
|
+
detectedAt: z.ZodString;
|
|
407
|
+
source: z.ZodString;
|
|
408
|
+
situation: z.ZodString;
|
|
409
|
+
context: z.ZodString;
|
|
410
|
+
interruptRequired: z.ZodBoolean;
|
|
411
|
+
affectedSessions: z.ZodArray<z.ZodString, "many">;
|
|
412
|
+
rationale: z.ZodString;
|
|
413
|
+
recommendation: z.ZodString;
|
|
414
|
+
draft: z.ZodOptional<z.ZodString>;
|
|
415
|
+
snapshot: z.ZodArray<z.ZodObject<{
|
|
416
|
+
sourceId: z.ZodString;
|
|
417
|
+
baseline: z.ZodString;
|
|
418
|
+
}, "strip", z.ZodTypeAny, {
|
|
419
|
+
sourceId: string;
|
|
420
|
+
baseline: string;
|
|
421
|
+
}, {
|
|
422
|
+
sourceId: string;
|
|
423
|
+
baseline: string;
|
|
424
|
+
}>, "many">;
|
|
425
|
+
threadLastEventId: z.ZodOptional<z.ZodString>;
|
|
426
|
+
}, "strip", z.ZodTypeAny, {
|
|
427
|
+
type: "informational" | "actionable" | "work";
|
|
428
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
429
|
+
snapshot: {
|
|
430
|
+
sourceId: string;
|
|
431
|
+
baseline: string;
|
|
432
|
+
}[];
|
|
433
|
+
priority: "P0" | "P1" | "P2";
|
|
434
|
+
title: string;
|
|
435
|
+
detectedAt: string;
|
|
436
|
+
source: string;
|
|
437
|
+
situation: string;
|
|
438
|
+
context: string;
|
|
439
|
+
interruptRequired: boolean;
|
|
440
|
+
affectedSessions: string[];
|
|
441
|
+
rationale: string;
|
|
442
|
+
recommendation: string;
|
|
443
|
+
threadLastEventId?: string | undefined;
|
|
444
|
+
draft?: string | undefined;
|
|
445
|
+
}, {
|
|
446
|
+
type: "informational" | "actionable" | "work";
|
|
447
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
448
|
+
snapshot: {
|
|
449
|
+
sourceId: string;
|
|
450
|
+
baseline: string;
|
|
451
|
+
}[];
|
|
452
|
+
priority: "P0" | "P1" | "P2";
|
|
453
|
+
title: string;
|
|
454
|
+
detectedAt: string;
|
|
455
|
+
source: string;
|
|
456
|
+
situation: string;
|
|
457
|
+
context: string;
|
|
458
|
+
interruptRequired: boolean;
|
|
459
|
+
affectedSessions: string[];
|
|
460
|
+
rationale: string;
|
|
461
|
+
recommendation: string;
|
|
462
|
+
threadLastEventId?: string | undefined;
|
|
463
|
+
draft?: string | undefined;
|
|
464
|
+
}>;
|
|
465
|
+
current: z.ZodOptional<z.ZodObject<{
|
|
466
|
+
observedAt: z.ZodString;
|
|
467
|
+
activeSessions: z.ZodArray<z.ZodString, "many">;
|
|
468
|
+
/** 생성 당시 판단과 달라졌는가 — Stored의 interruptRequired와 대비해 보여준다. */
|
|
469
|
+
affectsCurrentWork: z.ZodBoolean;
|
|
470
|
+
/** source별 baseline 변화. before가 없으면 요청이 그 source를 기록하지 않은 것이다. */
|
|
471
|
+
canonicalChanges: z.ZodArray<z.ZodObject<{
|
|
472
|
+
sourceId: z.ZodString;
|
|
473
|
+
before: z.ZodOptional<z.ZodString>;
|
|
474
|
+
after: z.ZodString;
|
|
475
|
+
}, "strip", z.ZodTypeAny, {
|
|
476
|
+
sourceId: string;
|
|
477
|
+
after: string;
|
|
478
|
+
before?: string | undefined;
|
|
479
|
+
}, {
|
|
480
|
+
sourceId: string;
|
|
481
|
+
after: string;
|
|
482
|
+
before?: string | undefined;
|
|
483
|
+
}>, "many">;
|
|
484
|
+
notes: z.ZodArray<z.ZodString, "many">;
|
|
485
|
+
}, "strip", z.ZodTypeAny, {
|
|
486
|
+
activeSessions: string[];
|
|
487
|
+
observedAt: string;
|
|
488
|
+
affectsCurrentWork: boolean;
|
|
489
|
+
canonicalChanges: {
|
|
490
|
+
sourceId: string;
|
|
491
|
+
after: string;
|
|
492
|
+
before?: string | undefined;
|
|
493
|
+
}[];
|
|
494
|
+
notes: string[];
|
|
495
|
+
}, {
|
|
496
|
+
activeSessions: string[];
|
|
497
|
+
observedAt: string;
|
|
498
|
+
affectsCurrentWork: boolean;
|
|
499
|
+
canonicalChanges: {
|
|
500
|
+
sourceId: string;
|
|
501
|
+
after: string;
|
|
502
|
+
before?: string | undefined;
|
|
503
|
+
}[];
|
|
504
|
+
notes: string[];
|
|
505
|
+
}>>;
|
|
506
|
+
freshness: z.ZodEnum<["CURRENT", "STALE_CONTEXT", "SOURCE_CHANGED", "ALREADY_DECIDED"]>;
|
|
507
|
+
verification: z.ZodObject<{
|
|
508
|
+
/** 활성 세션·Controller 상태 대조. */
|
|
509
|
+
localContext: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
510
|
+
/** 스레드 최신 이벤트와 canonical baseline 대조 — 외부 연결이 있어야 한다. */
|
|
511
|
+
source: z.ZodEnum<["VERIFIED", "UNAVAILABLE", "NOT_APPLICABLE"]>;
|
|
512
|
+
}, "strip", z.ZodTypeAny, {
|
|
513
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
514
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
515
|
+
}, {
|
|
516
|
+
source: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
517
|
+
localContext: "VERIFIED" | "UNAVAILABLE" | "NOT_APPLICABLE";
|
|
518
|
+
}>;
|
|
519
|
+
allowedDecisions: z.ZodArray<z.ZodEnum<["approve", "revise", "defer", "dismiss", "queue"]>, "atleastone">;
|
|
520
|
+
authorizedApprover: z.ZodString;
|
|
521
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
522
|
+
/** 이미 결정된 요청이면 그 사실과 결과를 표시한다. */
|
|
523
|
+
decided: z.ZodOptional<z.ZodObject<{
|
|
524
|
+
kind: z.ZodEnum<["approve", "revise", "defer", "dismiss", "queue"]>;
|
|
525
|
+
actor: z.ZodString;
|
|
526
|
+
channel: z.ZodString;
|
|
527
|
+
decidedAt: z.ZodString;
|
|
528
|
+
}, "strip", z.ZodTypeAny, {
|
|
529
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
530
|
+
actor: string;
|
|
531
|
+
channel: string;
|
|
532
|
+
decidedAt: string;
|
|
533
|
+
}, {
|
|
534
|
+
kind: "approve" | "revise" | "defer" | "dismiss" | "queue";
|
|
535
|
+
actor: string;
|
|
536
|
+
channel: string;
|
|
537
|
+
decidedAt: string;
|
|
538
|
+
}>>;
|
|
539
|
+
resultRef: z.ZodOptional<z.ZodString>;
|
|
540
|
+
}, "version" | "reference" | "requestId" | "freshness"> & {
|
|
541
|
+
status: z.ZodEnum<["AWAITING_APPROVAL", "APPROVED", "QUEUED", "DEFERRED", "DISMISSED", "DONE"]>;
|
|
542
|
+
priority: z.ZodEnum<["P0", "P1", "P2"]>;
|
|
543
|
+
title: z.ZodString;
|
|
544
|
+
detectedAt: z.ZodString;
|
|
545
|
+
}, "strip", z.ZodTypeAny, {
|
|
546
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
547
|
+
version: number;
|
|
548
|
+
priority: "P0" | "P1" | "P2";
|
|
549
|
+
title: string;
|
|
550
|
+
detectedAt: string;
|
|
551
|
+
reference: string;
|
|
552
|
+
requestId: string;
|
|
553
|
+
freshness: "CURRENT" | "STALE_CONTEXT" | "SOURCE_CHANGED" | "ALREADY_DECIDED";
|
|
554
|
+
}, {
|
|
555
|
+
status: "DONE" | "AWAITING_APPROVAL" | "APPROVED" | "QUEUED" | "DEFERRED" | "DISMISSED";
|
|
556
|
+
version: number;
|
|
557
|
+
priority: "P0" | "P1" | "P2";
|
|
558
|
+
title: string;
|
|
559
|
+
detectedAt: string;
|
|
560
|
+
reference: string;
|
|
561
|
+
requestId: string;
|
|
562
|
+
freshness: "CURRENT" | "STALE_CONTEXT" | "SOURCE_CHANGED" | "ALREADY_DECIDED";
|
|
563
|
+
}>;
|
|
564
|
+
export type DecisionSummary = z.infer<typeof DecisionSummary>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Shared Decision View Model — 모든 채널(MM/Local/Web)이 같은 ApprovalRequest를 각자
|
|
2
|
+
// 재구성하지 않도록 Renderer 앞에 두는 공통 의미 구조 (C-01 §3).
|
|
3
|
+
// 강제하는 것은 화면 모양이 아니라 의미 구조와 request reference의 동일성이다.
|
|
4
|
+
// 채널은 접기·요약할 수 있어도 필드의 뜻을 바꾸거나 새로 만들 수 없다.
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { CanonicalSnapshot, DecisionKind, EventType, Priority, RequestStatus } from "../model/entities.js";
|
|
7
|
+
import { RequestId, SessionId, Timestamp, Version } from "../model/ids.js";
|
|
8
|
+
/**
|
|
9
|
+
* 조회 시점 기준으로 이 요청이 얼마나 신선한지 (C-01 §7).
|
|
10
|
+
* 사용성·사전 경고 장치이며, 게시 직전 Drift Guard(OM §11.9)를 대체하지 않는다 —
|
|
11
|
+
* CURRENT로 보였더라도 Executor는 실행 직전 대상 상태를 다시 확인한다.
|
|
12
|
+
*/
|
|
13
|
+
export const Freshness = z.enum([
|
|
14
|
+
'CURRENT', // 확인할 수 있었던 범위에서 달라진 것이 없다 — 무엇을 확인했는지는 verification이 말한다
|
|
15
|
+
'STALE_CONTEXT', // 로컬 작업 맥락이 변했다 (Active Session 교체 등)
|
|
16
|
+
'SOURCE_CHANGED', // 대상 스레드 또는 canonical source가 변했다
|
|
17
|
+
'ALREADY_DECIDED', // 다른 채널에서 이미 결정됐다
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* 무엇을 실제로 확인했는지. `CURRENT`는 "변화 없음"이 아니라 "확인할 수 있었던 범위에서
|
|
21
|
+
* 변화 없음"이고, 그 범위가 어디까지였는지는 여기서만 알 수 있다.
|
|
22
|
+
* 이 구분이 없으면 외부 연결이 끊긴 채 조회한 결과와 정말로 조용한 요청이 똑같아 보인다.
|
|
23
|
+
*/
|
|
24
|
+
export const VerificationStatus = z.enum([
|
|
25
|
+
'VERIFIED', // 확인했고 달라진 것이 없다
|
|
26
|
+
'UNAVAILABLE', // 확인해야 하는데 확인할 수단이 없었다
|
|
27
|
+
'NOT_APPLICABLE', // 확인할 대상 자체가 없다
|
|
28
|
+
]);
|
|
29
|
+
export const VerificationCoverage = z.object({
|
|
30
|
+
/** 활성 세션·Controller 상태 대조. */
|
|
31
|
+
localContext: VerificationStatus,
|
|
32
|
+
/** 스레드 최신 이벤트와 canonical baseline 대조 — 외부 연결이 있어야 한다. */
|
|
33
|
+
source: VerificationStatus,
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* 요청 생성 당시의 분석. ApprovalRequest 원본에서 그대로 온 불변 값이다 (C-01 §6-A).
|
|
37
|
+
* 조회 시점의 현재 사실처럼 제시하면 안 된다.
|
|
38
|
+
*/
|
|
39
|
+
export const StoredPacket = z.object({
|
|
40
|
+
status: RequestStatus,
|
|
41
|
+
type: EventType,
|
|
42
|
+
priority: Priority,
|
|
43
|
+
title: z.string(),
|
|
44
|
+
detectedAt: Timestamp,
|
|
45
|
+
source: z.string(), // 사람이 읽는 참조 — "Issue #19"
|
|
46
|
+
situation: z.string(),
|
|
47
|
+
context: z.string(),
|
|
48
|
+
interruptRequired: z.boolean(),
|
|
49
|
+
affectedSessions: z.array(SessionId),
|
|
50
|
+
rationale: z.string(),
|
|
51
|
+
recommendation: z.string(),
|
|
52
|
+
draft: z.string().optional(),
|
|
53
|
+
snapshot: z.array(CanonicalSnapshot),
|
|
54
|
+
threadLastEventId: z.string().optional(),
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* 조회 시점에 state·controller·Active Session·Canonical을 다시 읽어 만든 파생 정보
|
|
58
|
+
* (C-01 §6-B). Derived View다 — 원본을 덮어쓰지 않고 History도 건드리지 않는다.
|
|
59
|
+
* 조회 환경이 이 정보를 만들 수 없으면 통째로 생략한다 (undefined).
|
|
60
|
+
*/
|
|
61
|
+
export const CurrentContextOverlay = z.object({
|
|
62
|
+
observedAt: Timestamp,
|
|
63
|
+
activeSessions: z.array(SessionId),
|
|
64
|
+
/** 생성 당시 판단과 달라졌는가 — Stored의 interruptRequired와 대비해 보여준다. */
|
|
65
|
+
affectsCurrentWork: z.boolean(),
|
|
66
|
+
/** source별 baseline 변화. before가 없으면 요청이 그 source를 기록하지 않은 것이다. */
|
|
67
|
+
canonicalChanges: z.array(z.object({ sourceId: z.string(), before: z.string().optional(), after: z.string() })),
|
|
68
|
+
notes: z.array(z.string()),
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* 전 채널 공통 view. `reference`는 어느 표현에서도 숨기지 않는다 — 사용자가 MM에서 본
|
|
72
|
+
* 요청을 로컬에서 그대로 지목할 수 있어야 하기 때문이다 (C-01 §2).
|
|
73
|
+
*/
|
|
74
|
+
export const DecisionView = z.object({
|
|
75
|
+
requestId: RequestId,
|
|
76
|
+
/** 복사 가능한 표시용 참조 — "ASC · P0 · REQ-0042 · Issue #19". */
|
|
77
|
+
reference: z.string().min(1),
|
|
78
|
+
version: Version, // 결정 제출 시 expectedVersion으로 되돌아온다
|
|
79
|
+
stored: StoredPacket,
|
|
80
|
+
current: CurrentContextOverlay.optional(),
|
|
81
|
+
freshness: Freshness,
|
|
82
|
+
verification: VerificationCoverage,
|
|
83
|
+
allowedDecisions: z.array(DecisionKind).nonempty(),
|
|
84
|
+
authorizedApprover: z.string(),
|
|
85
|
+
expiresAt: Timestamp.optional(),
|
|
86
|
+
/** 이미 결정된 요청이면 그 사실과 결과를 표시한다. */
|
|
87
|
+
decided: z
|
|
88
|
+
.object({ kind: DecisionKind, actor: z.string(), channel: z.string(), decidedAt: Timestamp })
|
|
89
|
+
.optional(),
|
|
90
|
+
resultRef: z.string().optional(),
|
|
91
|
+
});
|
|
92
|
+
/** 목록 표시용 축약형. 복수 후보를 나열할 때 쓴다 (C-01 §11). */
|
|
93
|
+
export const DecisionSummary = DecisionView.pick({
|
|
94
|
+
requestId: true,
|
|
95
|
+
reference: true,
|
|
96
|
+
version: true,
|
|
97
|
+
freshness: true,
|
|
98
|
+
}).extend({
|
|
99
|
+
status: RequestStatus,
|
|
100
|
+
priority: Priority,
|
|
101
|
+
title: z.string(),
|
|
102
|
+
detectedAt: Timestamp,
|
|
103
|
+
});
|