@memberjunction/task-graph 6.1.0-edge.1 → 6.1.0-edge.2
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/README.md +185 -0
- package/dist/TaskClaimStore.d.ts +11 -0
- package/dist/TaskClaimStore.d.ts.map +1 -1
- package/dist/TaskClaimStore.js +8 -3
- package/dist/TaskClaimStore.js.map +1 -1
- package/dist/TaskGraphDispatcher.d.ts +364 -2
- package/dist/TaskGraphDispatcher.d.ts.map +1 -1
- package/dist/TaskGraphDispatcher.js +1534 -37
- package/dist/TaskGraphDispatcher.js.map +1 -1
- package/dist/TaskGraphService.d.ts +110 -1
- package/dist/TaskGraphService.d.ts.map +1 -1
- package/dist/TaskGraphService.js +458 -19
- package/dist/TaskGraphService.js.map +1 -1
- package/dist/TaskLoopExecutor.d.ts +62 -0
- package/dist/TaskLoopExecutor.d.ts.map +1 -0
- package/dist/TaskLoopExecutor.js +248 -0
- package/dist/TaskLoopExecutor.js.map +1 -0
- package/dist/WorkflowSpecSync.d.ts +28 -2
- package/dist/WorkflowSpecSync.d.ts.map +1 -1
- package/dist/WorkflowSpecSync.js +83 -2
- package/dist/WorkflowSpecSync.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/operations/TaskGraphOperations.d.ts.map +1 -1
- package/dist/operations/TaskGraphOperations.js +4 -0
- package/dist/operations/TaskGraphOperations.js.map +1 -1
- package/dist/operations/WorkflowDraftOperation.d.ts +37 -0
- package/dist/operations/WorkflowDraftOperation.d.ts.map +1 -0
- package/dist/operations/WorkflowDraftOperation.js +141 -0
- package/dist/operations/WorkflowDraftOperation.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +10 -7
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# @memberjunction/task-graph
|
|
2
|
+
|
|
3
|
+
Durable execution of task graphs: submission, the dispatcher, the claim protocol, and the runners
|
|
4
|
+
that turn a node into work.
|
|
5
|
+
|
|
6
|
+
> **New to workflows?** Start with the [Workflows and Task Graphs
|
|
7
|
+
> Guide](../../guides/WORKFLOW_AND_TASK_GRAPH_GUIDE.md), which covers what a workflow is, when to
|
|
8
|
+
> use one, and every rule that decides what happens next. This README is the package tour.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What this package is for
|
|
13
|
+
|
|
14
|
+
A task graph is work that has to **outlive the thing that asked for it**. Before durable execution,
|
|
15
|
+
a multi-step agent plan lived inside one agent run: a page reload lost it, a server restart orphaned
|
|
16
|
+
it, and no channel other than the one that started it could see it.
|
|
17
|
+
|
|
18
|
+
This package is the other half of that split. Something else *produces* a graph; this package makes
|
|
19
|
+
it durable and runs it.
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
graph TB
|
|
23
|
+
subgraph Producers["Producers — anyone"]
|
|
24
|
+
P1["Flow agent<br/><i>compiled</i>"]
|
|
25
|
+
P2["Loop agent<br/><i>emitted</i>"]
|
|
26
|
+
P3["Entity action"]
|
|
27
|
+
P4["TaskGraph.Submit<br/><i>remote op</i>"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
P1 & P2 & P3 & P4 --> SVC["<b>TaskGraphService.Submit</b><br/>validate · resolve · persist"]
|
|
31
|
+
SVC --> ROWS["Task + TaskDependency"]
|
|
32
|
+
ROWS --> DISP["<b>TaskGraphDispatcher</b><br/>poll · claim · execute · settle"]
|
|
33
|
+
|
|
34
|
+
DISP --> R1["TaskAgentRunner"]
|
|
35
|
+
DISP --> R2["TaskActionRunner"]
|
|
36
|
+
DISP --> R3["TaskLoopExecutor"]
|
|
37
|
+
DISP --> R4["a person"]
|
|
38
|
+
|
|
39
|
+
style SVC fill:#7c5295,stroke:#563a6b,color:#fff
|
|
40
|
+
style ROWS fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
41
|
+
style DISP fill:#b8762f,stroke:#8a5722,color:#fff
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Submission never waits for execution.** `Submit` returns as soon as the graph is durable. That
|
|
45
|
+
split is what makes the engine invocation-agnostic: an agent, a scheduled job, a Slack message and a
|
|
46
|
+
manual UI all call the same method, and whichever dispatcher instance is running picks the work up.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## What it deliberately does not do
|
|
51
|
+
|
|
52
|
+
**It does not decide graph semantics.** Eligibility, failure propagation, parent rollup, skip
|
|
53
|
+
cascade, exclusive-group resolution and stall detection all come from pure, dependency-free
|
|
54
|
+
functions in [`@memberjunction/ai-core-plus`](../AI/CorePlus). That is not tidiness — it is what
|
|
55
|
+
stops the in-run executor and the durable executor from drifting apart. Neither owns the rules.
|
|
56
|
+
|
|
57
|
+
**It does not import MJServer.** Provider minting and agent execution arrive as injected seams
|
|
58
|
+
(`ProviderFactory`, `TaskAgentRunner`, `TaskActionRunner`), so the dependency runs
|
|
59
|
+
MJServer → task-graph and never the reverse. That is also what keeps the dispatcher unit-testable
|
|
60
|
+
without standing up the agent framework.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## The pieces
|
|
65
|
+
|
|
66
|
+
| File | Responsibility |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `TaskGraphService.ts` | Validate a spec, resolve names to IDs, write parent + children + edges. The only write path. |
|
|
69
|
+
| `TaskGraphDispatcher.ts` | Poll, claim, execute, evaluate edges, propagate, roll up, settle, credit cost. |
|
|
70
|
+
| `TaskClaimStore.ts` | The atomic claim protocol — guarded writes so two instances cannot run the same task. |
|
|
71
|
+
| `TaskLoopExecutor.ts` | `ForEach` / `While` semantics: bounds, ordering, concurrency, delay, failure. |
|
|
72
|
+
| `DispatcherConditionEvaluator.ts` | Edge conditions, over the superset context both dialects can read. |
|
|
73
|
+
| `TaskGraphSubmitterImpl.ts` | Registers the durable submitter under the `ClassFactory` seam. |
|
|
74
|
+
| `operations/` | The `TaskGraph.*` remote operations. |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Claiming: why a task runs exactly once
|
|
79
|
+
|
|
80
|
+
Multiple dispatcher instances poll the same table. Correctness comes from a **guarded write**, not
|
|
81
|
+
from coordination: claiming is an update that only succeeds if the row still looks the way the
|
|
82
|
+
claimer expects.
|
|
83
|
+
|
|
84
|
+
```mermaid
|
|
85
|
+
sequenceDiagram
|
|
86
|
+
participant A as Instance A
|
|
87
|
+
participant B as Instance B
|
|
88
|
+
participant DB as Task row
|
|
89
|
+
|
|
90
|
+
A->>DB: claim if unclaimed / expired
|
|
91
|
+
B->>DB: claim if unclaimed / expired
|
|
92
|
+
DB-->>A: 1 row updated ✅
|
|
93
|
+
DB-->>B: 0 rows updated ❌
|
|
94
|
+
Note over B: defers — no lock, no retry storm
|
|
95
|
+
loop while running
|
|
96
|
+
A->>DB: heartbeat (extends ClaimExpiresAt)
|
|
97
|
+
end
|
|
98
|
+
A->>DB: complete IF still owned by A
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If A dies, its claim expires and reconciliation makes the task claimable again. If A finishes but
|
|
102
|
+
the row changed underneath it (cancelled, reassigned, reclaimed), the guarded completion refuses and
|
|
103
|
+
A defers — overwriting would undo a newer, deliberate decision.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Runners are seams, not implementations
|
|
108
|
+
|
|
109
|
+
| Seam | Implemented by | Absent means |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `TaskAgentRunner` | `TaskGraphAgentRunner` (MJServer) | agent nodes cannot run here |
|
|
112
|
+
| `TaskActionRunner` | `TaskGraphActionRunner` (MJServer) | action nodes stay `Pending`, **not** Failed |
|
|
113
|
+
| `ProviderFactory` | `TaskGraphProviderFactory` (MJServer) | required |
|
|
114
|
+
| `TaskContinuationDeliverer` | `TaskGraphContinuationDeliverer` (MJServer) | outcomes are recorded but not announced |
|
|
115
|
+
| `TaskGraphObserver` | the frame resolver (MJServer) | nobody is watching; behaviour identical |
|
|
116
|
+
|
|
117
|
+
**A host with no runner is limited, not broken.** "Nobody here can run this" is not the same as
|
|
118
|
+
"this ran and did not work", so those tasks stay visible and claimable by an instance that can.
|
|
119
|
+
|
|
120
|
+
> **An Agent node starts a brand-new `AIAgentRun`** — a root run, linked from `Task.AgentRunID`
|
|
121
|
+
> rather than nested under the submitting run. The relationship is expressed by the Task row.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Starting a dispatcher
|
|
126
|
+
|
|
127
|
+
MJAPI does this for you (`StartTaskGraphDispatcher`). For a custom host:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { TaskGraphDispatcher, LoadTaskGraphOperations } from '@memberjunction/task-graph';
|
|
131
|
+
|
|
132
|
+
LoadTaskGraphOperations(); // registers the remote operations + the durable submitter
|
|
133
|
+
|
|
134
|
+
const dispatcher = new TaskGraphDispatcher(
|
|
135
|
+
providerFactory,
|
|
136
|
+
agentRunner,
|
|
137
|
+
contextUser,
|
|
138
|
+
{ InstanceID: `worker-${process.pid}` },
|
|
139
|
+
continuationDeliverer, // optional
|
|
140
|
+
observer, // optional
|
|
141
|
+
actionRunner, // optional
|
|
142
|
+
);
|
|
143
|
+
await dispatcher.Start();
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Without `LoadTaskGraphOperations()` nothing registers the submitter, and
|
|
147
|
+
`GetTaskGraphSubmitter()` returns `null` — which callers must report rather than swallow.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Cost rollup
|
|
152
|
+
|
|
153
|
+
When a graph settles, the dispatcher credits its spending back to the run that submitted it, writing
|
|
154
|
+
the `…Rollup` columns on `AIAgentRun`:
|
|
155
|
+
|
|
156
|
+
- `TotalCost` — what the submitting run itself spent. **Never rewritten here.**
|
|
157
|
+
- `TotalCostRollup` — that run plus everything it caused.
|
|
158
|
+
|
|
159
|
+
This cannot happen during the run: a submitting run *ends at submission*, so at the moment it
|
|
160
|
+
computes its own totals the graph has not spent anything yet. See the guide's [cost
|
|
161
|
+
section](../../guides/WORKFLOW_AND_TASK_GRAPH_GUIDE.md#cost-and-tokens-the-seam).
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Testing
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
cd packages/TaskGraph && pnpm test
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Unit tests cover the pure pieces — loop semantics, dispatchable kinds, configuration persistence,
|
|
172
|
+
parent metadata. The dispatcher driving **real rows against SQL Server** is covered by the `IT74`
|
|
173
|
+
bundle in `@memberjunction/integration-test-suite`, which uses a stub agent runner so it stays in
|
|
174
|
+
the deterministic tier: no model calls, no tokens, real claim protocol, real condition evaluator,
|
|
175
|
+
real rollup.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Related
|
|
180
|
+
|
|
181
|
+
- [Workflows and Task Graphs Guide](../../guides/WORKFLOW_AND_TASK_GRAPH_GUIDE.md) — start here
|
|
182
|
+
- [`@memberjunction/ai-core-plus`](../AI/CorePlus) — the spec, validator, compiler, pure algorithms,
|
|
183
|
+
payload mapping and layout
|
|
184
|
+
- [`@memberjunction/ai-agents`](../AI/Agents) — the agent framework and `FlowAgentType`
|
|
185
|
+
- [`packages/Actions/CLAUDE.md`](../Actions/CLAUDE.md) — Actions as boundaries
|
package/dist/TaskClaimStore.d.ts
CHANGED
|
@@ -82,6 +82,17 @@ export declare class TaskClaimStore {
|
|
|
82
82
|
OutputPayload?: string | null;
|
|
83
83
|
ErrorMessage?: string | null;
|
|
84
84
|
AgentRunID?: string | null;
|
|
85
|
+
/**
|
|
86
|
+
* The step's Configuration bag, when the run produced something that belongs in it.
|
|
87
|
+
*
|
|
88
|
+
* Written in the SAME guarded UPDATE as the rest of the outcome rather than a follow-up
|
|
89
|
+
* save, because a second write could land after the row was reclaimed and would then
|
|
90
|
+
* attribute one instance's runtime artefacts to another instance's execution.
|
|
91
|
+
*
|
|
92
|
+
* Omitted leaves the column untouched — a step whose run produces no artefacts must not
|
|
93
|
+
* have its authored configuration blanked as a side effect of finishing.
|
|
94
|
+
*/
|
|
95
|
+
Configuration?: string | null;
|
|
85
96
|
}, contextUser: UserInfo): Promise<boolean>;
|
|
86
97
|
/**
|
|
87
98
|
* Reclaims tasks whose claims have lapsed, returning them to `Pending` so any instance can pick
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskClaimStore.d.ts","sourceRoot":"","sources":["../src/TaskClaimStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,iBAAiB,EAA6C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAEnB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBADf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM;IAG5C,OAAO,CAAC,GAAG;IAIX,+EAA+E;IAC/E,OAAO,CAAC,SAAS;IAKjB;;;;;;;;;OASG;IACU,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB3G;;;;;;;;OAQG;IAC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;;OAQG;IACU,eAAe,CACxB,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B;;;;;;;;;WASG;QACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,EACD,WAAW,EAAE,QAAQ,GACtB,OAAO,CAAC,OAAO,CAAC;IA6BnB;;;;;;;;;;;OAWG;IACU,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA2CrH;;;;;;;OAOG;IACU,sBAAsB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAqBvH,iGAAiG;YACnF,YAAY;IAe1B,OAAO,CAAC,aAAa;IAIrB,4FAA4F;IAC5F,OAAO,CAAC,MAAM;CAGjB"}
|
package/dist/TaskClaimStore.js
CHANGED
|
@@ -113,6 +113,11 @@ export class TaskClaimStore {
|
|
|
113
113
|
sets.push(`${db.QuoteIdentifier('OutputPayload')} = ${this.literalOrNull(outcome.OutputPayload)}`);
|
|
114
114
|
sets.push(`${db.QuoteIdentifier('ErrorMessage')} = ${this.literalOrNull(outcome.ErrorMessage)}`);
|
|
115
115
|
sets.push(`${db.QuoteIdentifier('AgentRunID')} = ${outcome.AgentRunID ? `'${this.escape(outcome.AgentRunID)}'` : 'NULL'}`);
|
|
116
|
+
// Only when supplied — see the note on the parameter. `undefined` means "leave it alone",
|
|
117
|
+
// which is not the same as an explicit null.
|
|
118
|
+
if (outcome.Configuration !== undefined) {
|
|
119
|
+
sets.push(`${db.QuoteIdentifier('Configuration')} = ${this.literalOrNull(outcome.Configuration)}`);
|
|
120
|
+
}
|
|
116
121
|
const sql = `
|
|
117
122
|
UPDATE ${this.taskTable(provider)}
|
|
118
123
|
SET ${sets.join(', ')}
|
|
@@ -142,7 +147,7 @@ export class TaskClaimStore {
|
|
|
142
147
|
const candidates = await db.ExecuteSQL(`SELECT ${db.QuoteIdentifier('ID')}, ${db.QuoteIdentifier('Name')}, ${db.QuoteIdentifier('ClaimedBy')}
|
|
143
148
|
FROM ${this.taskTable(provider)}
|
|
144
149
|
WHERE ${db.QuoteIdentifier('Status')} = 'In Progress'
|
|
145
|
-
AND ${db.QuoteIdentifier('AgentID')} IS NOT NULL
|
|
150
|
+
AND (${db.QuoteIdentifier('AgentID')} IS NOT NULL OR ${db.QuoteIdentifier('ActionID')} IS NOT NULL)
|
|
146
151
|
AND ${db.QuoteIdentifier('ClaimedBy')} IS NOT NULL
|
|
147
152
|
AND ${db.QuoteIdentifier('ClaimExpiresAt')} IS NOT NULL
|
|
148
153
|
AND ${db.QuoteIdentifier('ClaimExpiresAt')} < '${now}'`, undefined, undefined, contextUser);
|
|
@@ -154,7 +159,7 @@ export class TaskClaimStore {
|
|
|
154
159
|
${db.QuoteIdentifier('ClaimedBy')} = NULL,
|
|
155
160
|
${db.QuoteIdentifier('ClaimExpiresAt')} = NULL
|
|
156
161
|
WHERE ${db.QuoteIdentifier('Status')} = 'In Progress'
|
|
157
|
-
AND ${db.QuoteIdentifier('AgentID')} IS NOT NULL
|
|
162
|
+
AND (${db.QuoteIdentifier('AgentID')} IS NOT NULL OR ${db.QuoteIdentifier('ActionID')} IS NOT NULL)
|
|
158
163
|
AND ${db.QuoteIdentifier('ClaimedBy')} IS NOT NULL
|
|
159
164
|
AND ${db.QuoteIdentifier('ClaimExpiresAt')} IS NOT NULL
|
|
160
165
|
AND ${db.QuoteIdentifier('ClaimExpiresAt')} < '${now}'`;
|
|
@@ -182,7 +187,7 @@ export class TaskClaimStore {
|
|
|
182
187
|
const rows = await db.ExecuteSQL(`SELECT ${db.QuoteIdentifier('ID')}, ${db.QuoteIdentifier('Name')}
|
|
183
188
|
FROM ${this.taskTable(provider)}
|
|
184
189
|
WHERE ${db.QuoteIdentifier('Status')} = 'In Progress'
|
|
185
|
-
AND ${db.QuoteIdentifier('AgentID')} IS NOT NULL
|
|
190
|
+
AND (${db.QuoteIdentifier('AgentID')} IS NOT NULL OR ${db.QuoteIdentifier('ActionID')} IS NOT NULL)
|
|
186
191
|
AND ${db.QuoteIdentifier('ClaimedBy')} IS NULL`, undefined, undefined, contextUser);
|
|
187
192
|
const events = (rows ?? []).map((r) => ({
|
|
188
193
|
TaskID: r.ID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskClaimStore.js","sourceRoot":"","sources":["../src/TaskClaimStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAA2C,QAAQ,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAY9G;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACvB,YACqB,UAAkB,EAClB,eAAuB;QADvB,eAAU,GAAV,UAAU,CAAQ;QAClB,oBAAe,GAAf,eAAe,CAAQ;IACzC,CAAC;IAEI,GAAG,CAAC,QAA2B;QACnC,OAAO,QAA2C,CAAC;IACvD,CAAC;IAED,+EAA+E;IACvE,SAAS,CAAC,QAA2B;QACzC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IACtF,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,QAAQ,CAAC,QAA2B,EAAE,MAAc,EAAE,WAAqB;QACpF,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,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