strands-darwin 0.0.34 → 0.0.35
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/patches/@strands-agents+sdk+1.16.0.patch +29 -15
- package/dist/patches/ink+7.1.1.patch +58 -0
- package/dist/src/agent/background-delegation.d.ts +3 -3
- package/dist/src/agent/background-delegation.js +2 -2
- package/dist/src/agent/background-delegation.js.map +1 -1
- package/dist/src/agent/context-breakdown.d.ts +2 -1
- package/dist/src/agent/context-breakdown.js +2 -1
- package/dist/src/agent/context-breakdown.js.map +1 -1
- package/dist/src/agent/instructions.d.ts +22 -3
- package/dist/src/agent/instructions.js +67 -34
- package/dist/src/agent/instructions.js.map +1 -1
- package/dist/src/agent/refusal.d.ts +44 -7
- package/dist/src/agent/refusal.js +54 -8
- package/dist/src/agent/refusal.js.map +1 -1
- package/dist/src/agent/runtime.d.ts +25 -6
- package/dist/src/agent/runtime.js +65 -17
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/agent/stream-resumption.d.ts +5 -2
- package/dist/src/agent/stream-resumption.js +5 -2
- package/dist/src/agent/stream-resumption.js.map +1 -1
- package/dist/src/agent/system-prompt.d.ts +1 -1
- package/dist/src/agent/system-prompt.js +4 -1
- package/dist/src/agent/system-prompt.js.map +1 -1
- package/dist/src/agent/thinking.js +4 -2
- package/dist/src/agent/thinking.js.map +1 -1
- package/dist/src/agents/subagent-tool.js +4 -3
- package/dist/src/agents/subagent-tool.js.map +1 -1
- package/dist/src/agents/workflow-tool.js +2 -2
- package/dist/src/agents/workflow-tool.js.map +1 -1
- package/dist/src/cli-doctor.js +7 -5
- package/dist/src/cli-doctor.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +1 -1
- package/dist/src/commands/custom-commands.js +7 -1
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/commands/init-command.d.ts +47 -0
- package/dist/src/commands/init-command.js +110 -0
- package/dist/src/commands/init-command.js.map +1 -0
- package/dist/src/config.d.ts +35 -3
- package/dist/src/config.js +127 -4
- package/dist/src/config.js.map +1 -1
- package/dist/src/dev-repl.js +17 -2
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-protocol.js +6 -5
- package/dist/src/headless-protocol.js.map +1 -1
- package/dist/src/headless-runner.js +5 -1
- package/dist/src/headless-runner.js.map +1 -1
- package/dist/src/headless.d.ts +11 -0
- package/dist/src/headless.js +33 -7
- package/dist/src/headless.js.map +1 -1
- package/dist/src/pricing/model-prices.d.ts +3 -1
- package/dist/src/pricing/model-prices.js +7 -1
- package/dist/src/pricing/model-prices.js.map +1 -1
- package/dist/src/tools/background-bash.d.ts +15 -3
- package/dist/src/tools/background-bash.js +18 -8
- package/dist/src/tools/background-bash.js.map +1 -1
- package/dist/src/tools/file-editor-serial.d.ts +14 -0
- package/dist/src/tools/file-editor-serial.js +15 -0
- package/dist/src/tools/file-editor-serial.js.map +1 -1
- package/dist/src/tools/shell-env.d.ts +77 -0
- package/dist/src/tools/shell-env.js +139 -0
- package/dist/src/tools/shell-env.js.map +1 -0
- package/dist/src/trajectory/replay.js +23 -0
- package/dist/src/trajectory/replay.js.map +1 -1
- package/dist/src/trajectory/writer.d.ts +44 -3
- package/dist/src/trajectory/writer.js +80 -14
- package/dist/src/trajectory/writer.js.map +1 -1
- package/dist/src/tui/App.d.ts +4 -1
- package/dist/src/tui/App.js +181 -36
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +1 -1
- package/dist/src/tui/InputBox.js +1 -1
- package/dist/src/tui/instructions-format.d.ts +14 -0
- package/dist/src/tui/instructions-format.js +24 -0
- package/dist/src/tui/instructions-format.js.map +1 -0
- package/dist/src/tui/prompt-queue.js +4 -2
- package/dist/src/tui/prompt-queue.js.map +1 -1
- package/dist/src/tui/status-format.d.ts +15 -0
- package/dist/src/tui/status-format.js +25 -0
- package/dist/src/tui/status-format.js.map +1 -1
- package/dist/src/tui/tangent.d.ts +122 -0
- package/dist/src/tui/tangent.js +153 -0
- package/dist/src/tui/tangent.js.map +1 -0
- package/dist/src/tui/turn-state.d.ts +12 -1
- package/dist/src/tui/turn-state.js +11 -0
- package/dist/src/tui/turn-state.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -107,8 +107,10 @@ For multiple switchable models, provider-specific fields, Bedrock Mantle, cachin
|
|
|
107
107
|
/developer <requirement>
|
|
108
108
|
/self-evolution-research
|
|
109
109
|
/help local command, prompt, and key reference
|
|
110
|
+
/init ask the model to create or improve this project's AGENTS.md
|
|
110
111
|
/copy copy the last completed answer to the clipboard (OSC 52, works over SSH)
|
|
111
112
|
/rewind branch conversation from a completed prompt (workspace unchanged)
|
|
113
|
+
/tangent bookmark the conversation for a side question; /tangent again returns
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
Use `Ctrl+R` to search this project's prompt history (type to filter, `Ctrl+R`/`Up`/`Down` to navigate, `Enter`/`Tab` to accept, `Escape` to cancel), `Ctrl+C` to cancel busy work, `Ctrl+B` to expand or compact tool details, and `/exit` or `Ctrl+D` to quit. In the composer, `Alt/Ctrl+Left/Right` or `Alt+B`/`Alt+F` moves by word, `Alt+Backspace`/`Alt+D` deletes the word before/after the cursor, and `Ctrl+_` (or `Ctrl+-`) undoes the last `Ctrl+K`/`Ctrl+U`, `Ctrl+W` or `Alt` word deletion. On an empty idle composer, `Esc` `Esc` (the second within 500 ms) opens the `/rewind` chooser — the same thing typing `/rewind` does; a single `Esc` there does nothing. Model tool calls still pass through the active permission mode; `!` commands are commands you authorize by typing them yourself.
|
package/README.zh-CN.md
CHANGED
|
@@ -107,8 +107,10 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
|
|
|
107
107
|
/developer <requirement>
|
|
108
108
|
/self-evolution-research
|
|
109
109
|
/help 查看本地命令、输入语法和按键说明
|
|
110
|
+
/init 请模型为当前项目创建或改进 AGENTS.md
|
|
110
111
|
/copy 把最近一条已完成回答复制到剪贴板(OSC 52,SSH 下可用)
|
|
111
112
|
/rewind 从已完成提示词分支对话(工作区不变)
|
|
113
|
+
/tangent 为一次旁支提问给对话加书签;再输入 /tangent 即返回
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Alt/Ctrl+Left/Right` 或 `Alt+B`/`Alt+F` 按词移动光标,`Alt+Backspace`/`Alt+D` 删除光标前/后的一个词,`Ctrl+_`(或 `Ctrl+-`)可撤销最近一次 `Ctrl+K`/`Ctrl+U`、`Ctrl+W` 或 `Alt` 系列的删词操作。输入框为空且空闲时,连按两次 `Esc`(第二次在 500 ms 内)会打开 `/rewind` 选择器,效果与输入 `/rewind` 完全相同;此时单按一次 `Esc` 不做任何事。模型发起的工具调用仍会经过当前审批模式;`!` 命令由你亲自输入,因此不走模型工具审批。
|
|
@@ -528,10 +528,10 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
|
|
|
528
528
|
//# sourceMappingURL=plugin.js.map
|
|
529
529
|
|
|
530
530
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
531
|
-
index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..
|
|
531
|
+
index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..aeef5bc02bb459333de75e2c93d97a4bf92ebdf7 100644
|
|
532
532
|
--- a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
533
533
|
+++ b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
534
|
-
@@ -1,12 +1,
|
|
534
|
+
@@ -1,12 +1,25 @@
|
|
535
535
|
-import type { BashOutput } from './types.js';
|
|
536
536
|
+import type { InvokableTool } from '../../index.js';
|
|
537
537
|
+import type { BashInput, BashOutput } from './types.js';
|
|
@@ -540,6 +540,12 @@ index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..8907d109ce2866e376df312ebc0bae1a
|
|
|
540
540
|
+ cwd?: string;
|
|
541
541
|
+ /** Session project root used only for conservative wrong-root path preflight. */
|
|
542
542
|
+ projectRoot?: string;
|
|
543
|
+
+ /**
|
|
544
|
+
+ * Environment for every persistent shell this tool starts (replacements after
|
|
545
|
+
+ * restart/exit included); `PS1`/`PS2` are still cleared on top. Absent means
|
|
546
|
+
+ * `process.env`, byte-identical to the behaviour without the option.
|
|
547
|
+
+ */
|
|
548
|
+
+ env?: Record<string, string>;
|
|
543
549
|
+}
|
|
544
550
|
+/**
|
|
545
551
|
+ * Create a host-only bash tool with configured persistent-shell path context.
|
|
@@ -559,7 +565,7 @@ index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..8907d109ce2866e376df312ebc0bae1a
|
|
|
559
565
|
//# sourceMappingURL=bash.d.ts.map
|
|
560
566
|
|
|
561
567
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
562
|
-
index 44fb775853169dab0fde7aee5e7cc275a060de9c..
|
|
568
|
+
index 44fb775853169dab0fde7aee5e7cc275a060de9c..7f3389ddd3e39704bb0ba5728dcf2c113b66efdf 100644
|
|
563
569
|
--- a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
564
570
|
+++ b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
565
571
|
@@ -1,8 +1,64 @@
|
|
@@ -685,7 +691,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
685
691
|
/**
|
|
686
692
|
* Internal class for managing a bash session.
|
|
687
693
|
*/
|
|
688
|
-
@@ -18,9 +125,
|
|
694
|
+
@@ -18,9 +125,25 @@ class BashSession {
|
|
689
695
|
_started = false;
|
|
690
696
|
_timeout;
|
|
691
697
|
_sentinel;
|
|
@@ -696,8 +702,12 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
696
702
|
+ _initialCwd;
|
|
697
703
|
+ _projectRoot;
|
|
698
704
|
+ _cwd;
|
|
699
|
-
+
|
|
705
|
+
+ _env;
|
|
706
|
+
+ constructor(timeout = 120, initialCwd = process.cwd(), projectRoot = null, env = null) {
|
|
700
707
|
this._timeout = timeout;
|
|
708
|
+
+ // The environment every shell this session starts inherits; null keeps the
|
|
709
|
+
+ // process's own, exactly as before the option existed.
|
|
710
|
+
+ this._env = env;
|
|
701
711
|
this._sentinel = `__BASH_DONE_${Date.now()}_${Math.random().toString(36).slice(2)}__`;
|
|
702
712
|
+ this._stderrSentinel = `${this._sentinel}_STDERR`;
|
|
703
713
|
+ this._exitCodeSentinel = `${this._sentinel}_EXIT`;
|
|
@@ -708,7 +718,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
708
718
|
}
|
|
709
719
|
/**
|
|
710
720
|
* Starts the bash process if not already started.
|
|
711
|
-
@@ -30,17 +
|
|
721
|
+
@@ -30,17 +153,28 @@ class BashSession {
|
|
712
722
|
return;
|
|
713
723
|
}
|
|
714
724
|
try {
|
|
@@ -716,8 +726,9 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
716
726
|
+ // timed-out foreground child down with it instead of orphaning it to pid 1.
|
|
717
727
|
this._process = spawn('bash', [], {
|
|
718
728
|
- cwd: process.cwd(),
|
|
729
|
+
- env: { ...process.env, PS1: '', PS2: '' },
|
|
719
730
|
+ cwd: this._initialCwd,
|
|
720
|
-
|
|
731
|
+
+ env: { ...(this._env ?? process.env), PS1: '', PS2: '' },
|
|
721
732
|
+ detached: true,
|
|
722
733
|
});
|
|
723
734
|
if (!this._process.stdin || !this._process.stdout || !this._process.stderr) {
|
|
@@ -740,7 +751,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
740
751
|
this._process = null;
|
|
741
752
|
this._started = false;
|
|
742
753
|
});
|
|
743
|
-
@@ -54,16 +
|
|
754
|
+
@@ -54,16 +188,43 @@ class BashSession {
|
|
744
755
|
*/
|
|
745
756
|
stop() {
|
|
746
757
|
if (this._process) {
|
|
@@ -787,7 +798,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
787
798
|
this.start();
|
|
788
799
|
if (!this._process || !this._process.stdin || !this._process.stdout || !this._process.stderr) {
|
|
789
800
|
throw new BashSessionError('Bash session not properly initialized');
|
|
790
|
-
@@ -72,33 +
|
|
801
|
+
@@ -72,33 +233,90 @@ class BashSession {
|
|
791
802
|
let stdoutData = '';
|
|
792
803
|
let stderrData = '';
|
|
793
804
|
let timeoutHandle = null;
|
|
@@ -888,7 +899,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
888
899
|
}
|
|
889
900
|
};
|
|
890
901
|
// Handler for process errors
|
|
891
|
-
@@ -107,13 +
|
|
902
|
+
@@ -107,13 +325,14 @@ class BashSession {
|
|
892
903
|
this.stop();
|
|
893
904
|
reject(new BashSessionError(`Bash process error: ${err.message}`));
|
|
894
905
|
};
|
|
@@ -905,7 +916,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
905
916
|
stdout.off('data', onStdoutData);
|
|
906
917
|
stderr.off('data', onStderrData);
|
|
907
918
|
// Check if process still exists before removing listeners
|
|
908
|
-
@@ -122,27 +
|
|
919
|
+
@@ -122,27 +341,77 @@ class BashSession {
|
|
909
920
|
this._process.off('error', onError);
|
|
910
921
|
}
|
|
911
922
|
};
|
|
@@ -987,7 +998,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
987
998
|
});
|
|
988
999
|
}
|
|
989
1000
|
}
|
|
990
|
-
@@ -151,6 +
|
|
1001
|
+
@@ -151,6 +420,16 @@ class BashSession {
|
|
991
1002
|
*/
|
|
992
1003
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
993
1004
|
const sessions = new WeakMap();
|
|
@@ -1004,7 +1015,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1004
1015
|
/**
|
|
1005
1016
|
* Track all active sessions for cleanup on process exit.
|
|
1006
1017
|
*/
|
|
1007
|
-
@@ -221,42 +
|
|
1018
|
+
@@ -221,42 +500,53 @@ const DEFAULT_DESCRIPTION = 'Executes bash shell commands in a persistent sessio
|
|
1008
1019
|
* State (variables, working directory) persists within the session.
|
|
1009
1020
|
* Node.js only.
|
|
1010
1021
|
*/
|
|
@@ -1031,6 +1042,9 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1031
1042
|
+ const initialCwd = path.resolve(options.cwd ?? process.cwd());
|
|
1032
1043
|
+ const projectRoot = options.projectRoot === undefined ? null : path.resolve(options.projectRoot);
|
|
1033
1044
|
+ const reportRestartCwd = options.cwd !== undefined || options.projectRoot !== undefined;
|
|
1045
|
+
+ // Copied once: the caller's map is the environment for every shell this tool
|
|
1046
|
+
+ // starts, including replacements after restart/exit; absent means process.env.
|
|
1047
|
+
+ const env = options.env === undefined ? null : { ...options.env };
|
|
1034
1048
|
+ return tool({
|
|
1035
1049
|
+ name: 'bash',
|
|
1036
1050
|
+ description: DEFAULT_DESCRIPTION,
|
|
@@ -1071,7 +1085,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1071
1085
|
+ sessions.delete(agent);
|
|
1072
1086
|
+ }
|
|
1073
1087
|
+ // Create new session (will be added to activeSessions when started)
|
|
1074
|
-
+ const newSession = new BashSession(120, initialCwd, projectRoot);
|
|
1088
|
+
+ const newSession = new BashSession(120, initialCwd, projectRoot, env);
|
|
1075
1089
|
+ sessions.set(agent, newSession);
|
|
1076
1090
|
+ sessionFinalizer.register(agent, newSession);
|
|
1077
1091
|
+ return reportRestartCwd ? `Bash session restarted\ncwd: ${initialCwd}` : 'Bash session restarted';
|
|
@@ -1080,7 +1094,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1080
1094
|
+ // Get or create session
|
|
1081
1095
|
+ let session = sessions.get(agent);
|
|
1082
1096
|
+ if (!session) {
|
|
1083
|
-
+ session = new BashSession(input.timeout ?? 120, initialCwd, projectRoot);
|
|
1097
|
+
+ session = new BashSession(input.timeout ?? 120, initialCwd, projectRoot, env);
|
|
1084
1098
|
+ sessions.set(agent, session);
|
|
1085
1099
|
+ sessionFinalizer.register(agent, session);
|
|
1086
1100
|
+ }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
diff --git a/node_modules/ink/build/ink.js b/node_modules/ink/build/ink.js
|
|
2
|
+
index 0082666b281ec2db77b875d6b8460bcc19a59ce7..dd772c834f77096cd3621f83bfa7d0fc0137ea47 100644
|
|
3
|
+
--- a/node_modules/ink/build/ink.js
|
|
4
|
+
+++ b/node_modules/ink/build/ink.js
|
|
5
|
+
@@ -155,6 +155,9 @@ export default class Ink {
|
|
6
|
+
lastOutputToRender;
|
|
7
|
+
lastOutputHeight;
|
|
8
|
+
lastTerminalWidth;
|
|
9
|
+
+ // Set by `resized` when the terminal got narrower: the next interactive frame
|
|
10
|
+
+ // redraws from a cleared screen instead of erasing by the stale line count.
|
|
11
|
+
+ redrawAfterNarrowing;
|
|
12
|
+
container;
|
|
13
|
+
rootNode;
|
|
14
|
+
// This variable is used only in debug mode to store full static output
|
|
15
|
+
@@ -279,8 +282,17 @@ export default class Ink {
|
|
16
|
+
resized = () => {
|
|
17
|
+
const currentWidth = getWindowSize(this.options.stdout).columns;
|
|
18
|
+
if (currentWidth < this.lastTerminalWidth) {
|
|
19
|
+
- // We clear the screen when decreasing terminal width to prevent duplicate overlapping re-renders.
|
|
20
|
+
- this.log.clear();
|
|
21
|
+
+ // A narrower terminal reflows the rows of the previous frame that no
|
|
22
|
+
+ // longer fit, so the frame now occupies more rows than the line count
|
|
23
|
+
+ // `log.clear()` would erase, and the top rows survive as stale copies
|
|
24
|
+
+ // (one per resize event). Redraw the next frame from a cleared screen
|
|
25
|
+
+ // with the full static output, the way overflowing frames already do,
|
|
26
|
+
+ // and drop any throttled write of the pre-resize frame that would
|
|
27
|
+
+ // otherwise land after the redraw.
|
|
28
|
+
+ if (typeof this.throttledLog.cancel === 'function') {
|
|
29
|
+
+ this.throttledLog.cancel();
|
|
30
|
+
+ }
|
|
31
|
+
+ this.redrawAfterNarrowing = true;
|
|
32
|
+
this.lastOutput = '';
|
|
33
|
+
this.lastOutputToRender = '';
|
|
34
|
+
}
|
|
35
|
+
@@ -753,13 +765,16 @@ export default class Ink {
|
|
36
|
+
const viewportRows = isTty ? getWindowSize(this.options.stdout).rows : 24;
|
|
37
|
+
const isFullscreen = isTty && outputHeight >= viewportRows;
|
|
38
|
+
const outputToRender = isFullscreen ? output : output + '\n';
|
|
39
|
+
- const shouldClearTerminal = shouldClearTerminalForFrame({
|
|
40
|
+
- isTty,
|
|
41
|
+
- viewportRows,
|
|
42
|
+
- previousOutputHeight: this.lastOutputHeight,
|
|
43
|
+
- nextOutputHeight: outputHeight,
|
|
44
|
+
- isUnmounting: this.isUnmounting,
|
|
45
|
+
- });
|
|
46
|
+
+ const redrawAfterNarrowing = this.redrawAfterNarrowing === true;
|
|
47
|
+
+ this.redrawAfterNarrowing = false;
|
|
48
|
+
+ const shouldClearTerminal = (isTty && redrawAfterNarrowing) ||
|
|
49
|
+
+ shouldClearTerminalForFrame({
|
|
50
|
+
+ isTty,
|
|
51
|
+
+ viewportRows,
|
|
52
|
+
+ previousOutputHeight: this.lastOutputHeight,
|
|
53
|
+
+ nextOutputHeight: outputHeight,
|
|
54
|
+
+ isUnmounting: this.isUnmounting,
|
|
55
|
+
+ });
|
|
56
|
+
if (shouldClearTerminal) {
|
|
57
|
+
const sync = this.shouldSync();
|
|
58
|
+
if (sync) {
|
|
@@ -77,13 +77,13 @@ export type BackgroundDelegationListener = (status: BackgroundDelegationStatus)
|
|
|
77
77
|
/** The first eight characters of an SDK task id (a UUID) — enough to tell tasks apart in a row. */
|
|
78
78
|
export declare function shortBackgroundTaskId(taskId: string): string;
|
|
79
79
|
/**
|
|
80
|
-
* The one refusal `/clear` and `/
|
|
81
|
-
* tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
80
|
+
* The one refusal `/clear`, `/rewind` and a `/tangent` return give while a background
|
|
81
|
+
* delegation is tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
82
82
|
* never a silent cancel of minutes of child work — the same rule as the SER-027 busy
|
|
83
83
|
* refusal. Shared by the TUI's local check and the runtime's own guard, so the two
|
|
84
84
|
* cannot word it differently.
|
|
85
85
|
*/
|
|
86
|
-
export declare function liveBackgroundDelegationRefusal(command: '/clear' | '/rewind', tasks: readonly BackgroundDelegationStatus[]): string;
|
|
86
|
+
export declare function liveBackgroundDelegationRefusal(command: '/clear' | '/rewind' | '/tangent', tasks: readonly BackgroundDelegationStatus[]): string;
|
|
87
87
|
/**
|
|
88
88
|
* Forwards background runs' `AfterToolCallEvent`s into the parent's stream and keeps
|
|
89
89
|
* the parent-side ledger of tracked delegations (SER-064, SER-070).
|
|
@@ -127,8 +127,8 @@ export function shortBackgroundTaskId(taskId) {
|
|
|
127
127
|
return taskId.length > 8 ? taskId.slice(0, 8) : taskId;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
|
-
* The one refusal `/clear` and `/
|
|
131
|
-
* tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
130
|
+
* The one refusal `/clear`, `/rewind` and a `/tangent` return give while a background
|
|
131
|
+
* delegation is tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
132
132
|
* never a silent cancel of minutes of child work — the same rule as the SER-027 busy
|
|
133
133
|
* refusal. Shared by the TUI's local check and the runtime's own guard, so the two
|
|
134
134
|
* cannot word it differently.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-delegation.js","sourceRoot":"","sources":["../../../src/agent/background-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,iFAAiF;AACjF,MAAM,CAAC,MAAM,gCAAgC,GAAG,gCAAgC,CAAC;AAEjF,iFAAiF;AACjF,MAAM,CAAC,MAAM,gCAAgC,GAAG,gCAAgC,CAAC;AAEjF,2EAA2E;AAC3E,MAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAqBzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAsC;IAC/E,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAA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E,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC/E,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;wBAAE,SAAS;oBAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;wBAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,SAAS;4BAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;oBAC7E,CAAC;gBACH,CAAC;YACH,CAAC;YACD,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACpB,MAAM,KAAK,CAAC;QACd,CAAC;QACD,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAEO,CAAC,KAAK;QACZ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,CAAC,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -67,7 +67,8 @@ export interface BreakdownInputs {
|
|
|
67
67
|
messages: readonly Message[];
|
|
68
68
|
}
|
|
69
69
|
export declare const BASE_PROMPT_LABEL = "system prompt \u00B7 base";
|
|
70
|
-
|
|
70
|
+
/** The `<project-instructions>` block — AGENTS.md or its CLAUDE.md fallback; the fragment's own `source` names which. */
|
|
71
|
+
export declare const PROJECT_INSTRUCTIONS_LABEL = "system prompt \u00B7 project instructions";
|
|
71
72
|
/** A restored prompt whose base block no longer equals the current composition. */
|
|
72
73
|
export declare const RESTORED_PROMPT_LABEL = "system prompt \u00B7 base + project instructions (restored)";
|
|
73
74
|
/** A prompt array in a shape Darwin does not own: counted whole rather than guessed at. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { composeSystemPrompt } from './instructions.js';
|
|
2
2
|
import { knownPromptSections } from '../skills/prompt.js';
|
|
3
3
|
export const BASE_PROMPT_LABEL = 'system prompt · base';
|
|
4
|
-
|
|
4
|
+
/** The `<project-instructions>` block — AGENTS.md or its CLAUDE.md fallback; the fragment's own `source` names which. */
|
|
5
|
+
export const PROJECT_INSTRUCTIONS_LABEL = 'system prompt · project instructions';
|
|
5
6
|
/** A restored prompt whose base block no longer equals the current composition. */
|
|
6
7
|
export const RESTORED_PROMPT_LABEL = 'system prompt · base + project instructions (restored)';
|
|
7
8
|
/** A prompt array in a shape Darwin does not own: counted whole rather than guessed at. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-breakdown.js","sourceRoot":"","sources":["../../../src/agent/context-breakdown.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2C1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,
|
|
1
|
+
{"version":3,"file":"context-breakdown.js","sourceRoot":"","sources":["../../../src/agent/context-breakdown.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2C1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,yHAAyH;AACzH,MAAM,CAAC,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AACjF,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,wDAA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ChC,KAAK,EAAE,GAAG,sBAAsB,GAAG,MAAM,CAAC,IAAI,EAAE;YAChD,KAAK,EAAE,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;SACrF,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
export declare const AGENTS_FILENAME = "AGENTS.md";
|
|
2
|
+
/** Read only when {@link AGENTS_FILENAME} does not exist. */
|
|
3
|
+
export declare const CLAUDE_FILENAME = "CLAUDE.md";
|
|
4
|
+
export type InstructionsFilename = typeof AGENTS_FILENAME | typeof CLAUDE_FILENAME;
|
|
5
|
+
/**
|
|
6
|
+
* One fixed line for the CLAUDE.md case only. Claude Code expands `@path` lines
|
|
7
|
+
* into the referenced files; darwin does not, so without this the model would
|
|
8
|
+
* take an import line for content it has already been given.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLAUDE_IMPORT_NOTICE: string;
|
|
2
11
|
/**
|
|
3
12
|
* Instructions past this size are truncated rather than sent whole.
|
|
4
13
|
*
|
|
@@ -8,6 +17,8 @@ export declare const AGENTS_FILENAME = "AGENTS.md";
|
|
|
8
17
|
*/
|
|
9
18
|
export declare const MAX_INSTRUCTIONS_BYTES: number;
|
|
10
19
|
export interface ProjectInstructions {
|
|
20
|
+
/** Which of the two names was actually loaded. */
|
|
21
|
+
filename: InstructionsFilename;
|
|
11
22
|
/** Absolute path of the file that was read. */
|
|
12
23
|
path: string;
|
|
13
24
|
/** Size on disk, in bytes, before any truncation. */
|
|
@@ -23,13 +34,16 @@ export interface ProjectInstructionsLoad {
|
|
|
23
34
|
/** What to inject, or undefined when there is nothing usable to inject. */
|
|
24
35
|
instructions: ProjectInstructions | undefined;
|
|
25
36
|
/**
|
|
26
|
-
* Why
|
|
27
|
-
*
|
|
37
|
+
* Why a file that is present could not be used. Undefined both when a file
|
|
38
|
+
* loaded and when there is no file at all — those two need no reporting.
|
|
28
39
|
*/
|
|
29
40
|
problem: string | undefined;
|
|
41
|
+
/** The file `problem` is about; undefined exactly when `problem` is. */
|
|
42
|
+
problemFile: InstructionsFilename | undefined;
|
|
30
43
|
}
|
|
31
44
|
/**
|
|
32
|
-
* Reads `<projectRoot>/AGENTS.md
|
|
45
|
+
* Reads `<projectRoot>/AGENTS.md`, or `<projectRoot>/CLAUDE.md` when the former
|
|
46
|
+
* does not exist.
|
|
33
47
|
*
|
|
34
48
|
* A broken file never blocks startup — the agent works without project
|
|
35
49
|
* instructions — but the two ways of ending up without them are not the same. No
|
|
@@ -38,6 +52,11 @@ export interface ProjectInstructionsLoad {
|
|
|
38
52
|
* user has rules they believe are in effect and nothing on screen contradicts
|
|
39
53
|
* that. Same isolation rule as a broken skill directory: skip it, say why.
|
|
40
54
|
*
|
|
55
|
+
* Only a truly missing `AGENTS.md` moves on to `CLAUDE.md`: an unreadable one is
|
|
56
|
+
* reported as such and never falls through, because the file the user wrote
|
|
57
|
+
* rules into is the one that must decide. Whichever file is found first is the
|
|
58
|
+
* only one opened.
|
|
59
|
+
*
|
|
41
60
|
* An empty or whitespace-only file is silently skipped: injecting the delimiters
|
|
42
61
|
* with nothing between them would only point the model at emptiness.
|
|
43
62
|
*/
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Project instructions preloaded from AGENTS.md.
|
|
2
|
+
* Project instructions preloaded from AGENTS.md — or, when there is none, CLAUDE.md.
|
|
3
3
|
*
|
|
4
|
-
* Only the run directory's own
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Only the run directory's own file is read: no walking up to parent directories
|
|
5
|
+
* and no merging of several files, so what reaches the model is exactly one file
|
|
6
|
+
* sitting next to the repository the user is working in. There is exactly one
|
|
7
|
+
* fallback name and it is fixed: `CLAUDE.md` (Claude Code's convention) is tried
|
|
8
|
+
* only when `AGENTS.md` does not exist at all. An `AGENTS.md` that is present but
|
|
9
|
+
* unusable decides the outcome by itself; when both files exist, `CLAUDE.md` is
|
|
10
|
+
* never opened.
|
|
7
11
|
*/
|
|
8
12
|
import { readFile } from 'node:fs/promises';
|
|
9
13
|
import path from 'node:path';
|
|
10
14
|
import { StringDecoder } from 'node:string_decoder';
|
|
11
15
|
export const AGENTS_FILENAME = 'AGENTS.md';
|
|
16
|
+
/** Read only when {@link AGENTS_FILENAME} does not exist. */
|
|
17
|
+
export const CLAUDE_FILENAME = 'CLAUDE.md';
|
|
18
|
+
/** Lookup order — the first file that exists decides, whether or not it can be read. */
|
|
19
|
+
const INSTRUCTIONS_FILENAMES = [AGENTS_FILENAME, CLAUDE_FILENAME];
|
|
20
|
+
/**
|
|
21
|
+
* One fixed line for the CLAUDE.md case only. Claude Code expands `@path` lines
|
|
22
|
+
* into the referenced files; darwin does not, so without this the model would
|
|
23
|
+
* take an import line for content it has already been given.
|
|
24
|
+
*/
|
|
25
|
+
export const CLAUDE_IMPORT_NOTICE = `(Loaded from ${CLAUDE_FILENAME} because there is no ${AGENTS_FILENAME}. ` +
|
|
26
|
+
'`@path` import lines are not expanded by darwin: they are literal text here, not loaded content.)';
|
|
12
27
|
/**
|
|
13
28
|
* Instructions past this size are truncated rather than sent whole.
|
|
14
29
|
*
|
|
@@ -18,7 +33,8 @@ export const AGENTS_FILENAME = 'AGENTS.md';
|
|
|
18
33
|
*/
|
|
19
34
|
export const MAX_INSTRUCTIONS_BYTES = 32 * 1024;
|
|
20
35
|
/**
|
|
21
|
-
* Reads `<projectRoot>/AGENTS.md
|
|
36
|
+
* Reads `<projectRoot>/AGENTS.md`, or `<projectRoot>/CLAUDE.md` when the former
|
|
37
|
+
* does not exist.
|
|
22
38
|
*
|
|
23
39
|
* A broken file never blocks startup — the agent works without project
|
|
24
40
|
* instructions — but the two ways of ending up without them are not the same. No
|
|
@@ -27,34 +43,46 @@ export const MAX_INSTRUCTIONS_BYTES = 32 * 1024;
|
|
|
27
43
|
* user has rules they believe are in effect and nothing on screen contradicts
|
|
28
44
|
* that. Same isolation rule as a broken skill directory: skip it, say why.
|
|
29
45
|
*
|
|
46
|
+
* Only a truly missing `AGENTS.md` moves on to `CLAUDE.md`: an unreadable one is
|
|
47
|
+
* reported as such and never falls through, because the file the user wrote
|
|
48
|
+
* rules into is the one that must decide. Whichever file is found first is the
|
|
49
|
+
* only one opened.
|
|
50
|
+
*
|
|
30
51
|
* An empty or whitespace-only file is silently skipped: injecting the delimiters
|
|
31
52
|
* with nothing between them would only point the model at emptiness.
|
|
32
53
|
*/
|
|
33
54
|
export async function loadProjectInstructions(projectRoot) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
for (const filename of INSTRUCTIONS_FILENAMES) {
|
|
56
|
+
const filePath = path.join(projectRoot, filename);
|
|
57
|
+
let raw;
|
|
58
|
+
try {
|
|
59
|
+
raw = await readFile(filePath);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (isMissingFile(error))
|
|
63
|
+
continue;
|
|
64
|
+
return { instructions: undefined, problem: describe(error), problemFile: filename };
|
|
65
|
+
}
|
|
66
|
+
const bytes = raw.byteLength;
|
|
67
|
+
const truncated = bytes > MAX_INSTRUCTIONS_BYTES;
|
|
68
|
+
const text = truncated
|
|
69
|
+
? clipToLastLine(raw.subarray(0, MAX_INSTRUCTIONS_BYTES))
|
|
70
|
+
: raw.toString('utf8');
|
|
71
|
+
if (text.trim() === '')
|
|
72
|
+
return { instructions: undefined, problem: undefined, problemFile: undefined };
|
|
73
|
+
return {
|
|
74
|
+
instructions: {
|
|
75
|
+
filename,
|
|
76
|
+
path: filePath,
|
|
77
|
+
bytes,
|
|
78
|
+
truncated,
|
|
79
|
+
fragment: renderFragment(text.trimEnd(), truncated, filename),
|
|
80
|
+
},
|
|
81
|
+
problem: undefined,
|
|
82
|
+
problemFile: undefined,
|
|
83
|
+
};
|
|
41
84
|
}
|
|
42
|
-
|
|
43
|
-
const truncated = bytes > MAX_INSTRUCTIONS_BYTES;
|
|
44
|
-
const text = truncated
|
|
45
|
-
? clipToLastLine(raw.subarray(0, MAX_INSTRUCTIONS_BYTES))
|
|
46
|
-
: raw.toString('utf8');
|
|
47
|
-
if (text.trim() === '')
|
|
48
|
-
return { instructions: undefined, problem: undefined };
|
|
49
|
-
return {
|
|
50
|
-
instructions: {
|
|
51
|
-
path: filePath,
|
|
52
|
-
bytes,
|
|
53
|
-
truncated,
|
|
54
|
-
fragment: renderFragment(text.trimEnd(), truncated),
|
|
55
|
-
},
|
|
56
|
-
problem: undefined,
|
|
57
|
-
};
|
|
85
|
+
return { instructions: undefined, problem: undefined, problemFile: undefined };
|
|
58
86
|
}
|
|
59
87
|
/**
|
|
60
88
|
* Places project instructions directly after the base prompt.
|
|
@@ -71,10 +99,11 @@ export function composeSystemPrompt(basePrompt, instructions) {
|
|
|
71
99
|
return `${basePrompt}\n\n${instructions.fragment}`;
|
|
72
100
|
}
|
|
73
101
|
/**
|
|
74
|
-
* True when the file is simply not there
|
|
102
|
+
* True when the file is simply not there — the only case that moves on to the
|
|
103
|
+
* fallback name.
|
|
75
104
|
*
|
|
76
105
|
* `ENOTDIR` counts: a path component that is a file rather than a directory means
|
|
77
|
-
* there is no
|
|
106
|
+
* there is no such file at that location either.
|
|
78
107
|
*/
|
|
79
108
|
function isMissingFile(error) {
|
|
80
109
|
const code = typeof error === 'object' && error !== null ? error.code : undefined;
|
|
@@ -100,14 +129,18 @@ function clipToLastLine(slice) {
|
|
|
100
129
|
/**
|
|
101
130
|
* Wraps the text in a labelled block. The source attribute matters: the model has
|
|
102
131
|
* to be able to tell these instructions came from the project's own file rather
|
|
103
|
-
* than from darwin itself, since only one of the two is something the user can edit
|
|
132
|
+
* than from darwin itself, since only one of the two is something the user can edit
|
|
133
|
+
* — and which file, since a CLAUDE.md may lean on Claude Code features (its
|
|
134
|
+
* `@path` imports) that darwin does not provide; {@link CLAUDE_IMPORT_NOTICE} says
|
|
135
|
+
* so once, in that case only.
|
|
104
136
|
*/
|
|
105
|
-
function renderFragment(text, truncated) {
|
|
137
|
+
function renderFragment(text, truncated, filename) {
|
|
106
138
|
const attributes = truncated
|
|
107
|
-
? `source="${
|
|
108
|
-
: `source="${
|
|
139
|
+
? `source="${filename}" truncated="true"`
|
|
140
|
+
: `source="${filename}"`;
|
|
109
141
|
return [
|
|
110
142
|
`<project-instructions ${attributes}>`,
|
|
143
|
+
...(filename === CLAUDE_FILENAME ? [CLAUDE_IMPORT_NOTICE] : []),
|
|
111
144
|
text,
|
|
112
145
|
...(truncated
|
|
113
146
|
? [`(This file is larger than ${MAX_INSTRUCTIONS_BYTES / 1024} KB and was cut off here.)`]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/agent/instructions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/agent/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAI3C,wFAAwF;AACxF,MAAM,sBAAsB,GAAoC,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAEnG;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B,gBAAgB,eAAe,wBAAwB,eAAe,IAAI;IAC1E,mGAAmG,CAAC;AAEtG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,CAAC;AA8BhD;;;;;;;;;;;;;;;;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