@wrongstack/tui 0.307.0 → 0.308.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/dist/app-state-core-types.d.ts +7 -0
- package/dist/index.js +47 -9
- package/dist/input-tokens.d.ts +9 -3
- package/package.json +7 -7
|
@@ -6,6 +6,13 @@ export interface QueueItem {
|
|
|
6
6
|
blocks: ContentBlock[];
|
|
7
7
|
/** When true, the item will be refined via model.refine before entering the agent context. */
|
|
8
8
|
shouldRefine?: boolean | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Raw (pre-refinement) user text for prompt-journal provenance. Stamped
|
|
11
|
+
* into `ctx.meta[PROMPT_JOURNAL_RAW_MARKER]` by the queue drainer right
|
|
12
|
+
* before the item runs — NOT at enqueue time — so each queued item keeps
|
|
13
|
+
* its own raw text and clearing the queue can never orphan a stale marker.
|
|
14
|
+
*/
|
|
15
|
+
journalRaw?: string | undefined;
|
|
9
16
|
}
|
|
10
17
|
/** A registered slash command matched against the user's current / query. */
|
|
11
18
|
export interface SlashCommandMatch {
|
package/dist/index.js
CHANGED
|
@@ -22076,7 +22076,9 @@ function fnKey(data) {
|
|
|
22076
22076
|
}
|
|
22077
22077
|
|
|
22078
22078
|
// src/input-tokens.ts
|
|
22079
|
-
var
|
|
22079
|
+
var ATTACHMENT_TOKEN_SRC = "\\[(?:pasted|image|file) #\\d+[^\\]]*\\]|\\[file:[^\\]]+\\]";
|
|
22080
|
+
var PROTOCOL_TOKEN_SRC = "\\[VIBE\\]";
|
|
22081
|
+
var INLINE_TOKEN_SRC = `${ATTACHMENT_TOKEN_SRC}|${PROTOCOL_TOKEN_SRC}`;
|
|
22080
22082
|
var AT_END = new RegExp(`(?:${INLINE_TOKEN_SRC})$`, "i");
|
|
22081
22083
|
var AT_START = new RegExp(`^(?:${INLINE_TOKEN_SRC})`, "i");
|
|
22082
22084
|
var GLOBAL = new RegExp(INLINE_TOKEN_SRC, "gi");
|
|
@@ -27905,15 +27907,27 @@ function createAppKeyHandler(options) {
|
|
|
27905
27907
|
}
|
|
27906
27908
|
|
|
27907
27909
|
// src/run-blocks-controller.ts
|
|
27910
|
+
import { PROMPT_JOURNAL_RAW_MARKER } from "@wrongstack/core/prompts";
|
|
27908
27911
|
import { toErrorMessage as toErrorMessage3 } from "@wrongstack/core/utils";
|
|
27909
27912
|
import { routeImagesForModel } from "@wrongstack/runtime/vision";
|
|
27910
27913
|
function createRunBlocksController(host) {
|
|
27911
27914
|
const runBlocks = async (blocks) => {
|
|
27912
27915
|
const { capabilities, refs, dispatch } = host;
|
|
27913
27916
|
const { agent } = capabilities;
|
|
27917
|
+
const capturedRaw = typeof agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER] === "string" ? agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER] : void 0;
|
|
27918
|
+
if (capturedRaw !== void 0) {
|
|
27919
|
+
delete agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER];
|
|
27920
|
+
}
|
|
27914
27921
|
if (refs.activeController.current) {
|
|
27915
27922
|
const displayText = blocks.filter((block) => block.type === "text").map((block) => block.text).join(" ").trim() || "(queued input)";
|
|
27916
|
-
dispatch({
|
|
27923
|
+
dispatch({
|
|
27924
|
+
type: "enqueue",
|
|
27925
|
+
item: {
|
|
27926
|
+
displayText,
|
|
27927
|
+
blocks,
|
|
27928
|
+
...capturedRaw !== void 0 ? { journalRaw: capturedRaw } : {}
|
|
27929
|
+
}
|
|
27930
|
+
});
|
|
27917
27931
|
return;
|
|
27918
27932
|
}
|
|
27919
27933
|
const runGeneration = refs.sessionGeneration.current;
|
|
@@ -27950,6 +27964,9 @@ function createRunBlocksController(host) {
|
|
|
27950
27964
|
});
|
|
27951
27965
|
}
|
|
27952
27966
|
refs.assistantCommitted.current = false;
|
|
27967
|
+
if (capturedRaw !== void 0) {
|
|
27968
|
+
agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER] = capturedRaw;
|
|
27969
|
+
}
|
|
27953
27970
|
const result = await agent.run(routed.blocks, { signal: controller.signal });
|
|
27954
27971
|
if (runGeneration !== refs.sessionGeneration.current) return;
|
|
27955
27972
|
refs.streamingText.current = "";
|
|
@@ -28041,6 +28058,9 @@ function createRunBlocksController(host) {
|
|
|
28041
28058
|
if (head) {
|
|
28042
28059
|
dispatch({ type: "dequeueFirst" });
|
|
28043
28060
|
dispatch({ type: "addEntry", entry: { kind: "user", text: head.displayText } });
|
|
28061
|
+
if (head.journalRaw) {
|
|
28062
|
+
agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER] = head.journalRaw;
|
|
28063
|
+
}
|
|
28044
28064
|
await runBlocks(head.blocks);
|
|
28045
28065
|
}
|
|
28046
28066
|
};
|
|
@@ -28053,6 +28073,7 @@ import {
|
|
|
28053
28073
|
resolveContinuation,
|
|
28054
28074
|
setBtwNote
|
|
28055
28075
|
} from "@wrongstack/core/agent";
|
|
28076
|
+
import { PROMPT_JOURNAL_RAW_MARKER as PROMPT_JOURNAL_RAW_MARKER2 } from "@wrongstack/core/prompts";
|
|
28056
28077
|
import { toErrorMessage as toErrorMessage4 } from "@wrongstack/core/utils";
|
|
28057
28078
|
import { todoTool } from "@wrongstack/tools/todo";
|
|
28058
28079
|
|
|
@@ -28145,7 +28166,7 @@ async function refineSubmittedPrompt(host, trimmed, options) {
|
|
|
28145
28166
|
let effectiveText = trimmed;
|
|
28146
28167
|
const chips = [];
|
|
28147
28168
|
let cleanText = trimmed;
|
|
28148
|
-
const chipPattern = new RegExp(
|
|
28169
|
+
const chipPattern = new RegExp(ATTACHMENT_TOKEN_SRC, "g");
|
|
28149
28170
|
for (const chipMatch of trimmed.matchAll(chipPattern)) chips.push(chipMatch[0]);
|
|
28150
28171
|
if (chips.length > 0) {
|
|
28151
28172
|
cleanText = trimmed.replace(chipPattern, "").replace(/\s{2,}/g, " ").trim();
|
|
@@ -28985,6 +29006,10 @@ New topic: ${advice.nextTopic}` : "";
|
|
|
28985
29006
|
}
|
|
28986
29007
|
effectiveText = continueResolved.text;
|
|
28987
29008
|
}
|
|
29009
|
+
const refinedRaw = effectiveText !== trimmed && trimmed ? trimmed : void 0;
|
|
29010
|
+
const stampJournalMarker = () => {
|
|
29011
|
+
if (refinedRaw) agent.ctx.meta[PROMPT_JOURNAL_RAW_MARKER2] = refinedRaw;
|
|
29012
|
+
};
|
|
28988
29013
|
if (sddContext && trimmed) {
|
|
28989
29014
|
builder.appendText(`[SDD SESSION ACTIVE]
|
|
28990
29015
|
${sddContext}
|
|
@@ -29053,6 +29078,7 @@ User message:
|
|
|
29053
29078
|
await new Promise((r) => setTimeout(r, 25));
|
|
29054
29079
|
}
|
|
29055
29080
|
try {
|
|
29081
|
+
stampJournalMarker();
|
|
29056
29082
|
await runBlocks(steerBlocks);
|
|
29057
29083
|
} finally {
|
|
29058
29084
|
clearDraft();
|
|
@@ -29068,13 +29094,21 @@ User message:
|
|
|
29068
29094
|
type: "addEntry",
|
|
29069
29095
|
entry: { kind: "user", text: displayText, queued: true, pasteContent }
|
|
29070
29096
|
});
|
|
29071
|
-
dispatch({
|
|
29097
|
+
dispatch({
|
|
29098
|
+
type: "enqueue",
|
|
29099
|
+
item: {
|
|
29100
|
+
displayText,
|
|
29101
|
+
blocks,
|
|
29102
|
+
...refinedRaw ? { journalRaw: refinedRaw } : {}
|
|
29103
|
+
}
|
|
29104
|
+
});
|
|
29072
29105
|
return;
|
|
29073
29106
|
}
|
|
29074
29107
|
dispatch({ type: "addEntry", entry: { kind: "user", text: displayText, pasteContent } });
|
|
29075
29108
|
if (autonomyLive === "auto" && nextStepsAutoSubmitTimerRef.current != null) {
|
|
29076
29109
|
switchAutonomy?.("off");
|
|
29077
29110
|
}
|
|
29111
|
+
stampJournalMarker();
|
|
29078
29112
|
await runBlocks(blocks);
|
|
29079
29113
|
};
|
|
29080
29114
|
return submit;
|
|
@@ -32758,10 +32792,11 @@ function reduceComposer(state, action) {
|
|
|
32758
32792
|
const item = { ...action.item, id: state.nextQueueId };
|
|
32759
32793
|
const candidate = [...state.queue, item];
|
|
32760
32794
|
const persisted = candidate.map(
|
|
32761
|
-
({ displayText, blocks, shouldRefine }) => ({
|
|
32795
|
+
({ displayText, blocks, shouldRefine, journalRaw }) => ({
|
|
32762
32796
|
displayText,
|
|
32763
32797
|
blocks,
|
|
32764
|
-
...shouldRefine !== void 0 ? { shouldRefine } : {}
|
|
32798
|
+
...shouldRefine !== void 0 ? { shouldRefine } : {},
|
|
32799
|
+
...journalRaw !== void 0 ? { journalRaw } : {}
|
|
32765
32800
|
})
|
|
32766
32801
|
);
|
|
32767
32802
|
if (retainPersistedQueueItems(persisted).length !== candidate.length) return state;
|
|
@@ -41705,7 +41740,8 @@ function useQueueManager({
|
|
|
41705
41740
|
item: {
|
|
41706
41741
|
displayText: item.displayText,
|
|
41707
41742
|
blocks: item.blocks,
|
|
41708
|
-
...item.shouldRefine !== void 0 ? { shouldRefine: item.shouldRefine } : {}
|
|
41743
|
+
...item.shouldRefine !== void 0 ? { shouldRefine: item.shouldRefine } : {},
|
|
41744
|
+
...item.journalRaw !== void 0 ? { journalRaw: item.journalRaw } : {}
|
|
41709
41745
|
}
|
|
41710
41746
|
});
|
|
41711
41747
|
}
|
|
@@ -41727,11 +41763,13 @@ function useQueueManager({
|
|
|
41727
41763
|
({
|
|
41728
41764
|
displayText,
|
|
41729
41765
|
blocks,
|
|
41730
|
-
shouldRefine
|
|
41766
|
+
shouldRefine,
|
|
41767
|
+
journalRaw
|
|
41731
41768
|
}) => ({
|
|
41732
41769
|
displayText,
|
|
41733
41770
|
blocks,
|
|
41734
|
-
...shouldRefine !== void 0 ? { shouldRefine } : {}
|
|
41771
|
+
...shouldRefine !== void 0 ? { shouldRefine } : {},
|
|
41772
|
+
...journalRaw !== void 0 ? { journalRaw } : {}
|
|
41735
41773
|
})
|
|
41736
41774
|
);
|
|
41737
41775
|
const persistence = persistState.current;
|
package/dist/input-tokens.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Inline
|
|
3
|
-
*
|
|
4
|
-
* AttachmentStore placeholder regex in @wrongstack/core
|
|
2
|
+
* Inline chip token grammar, shared by the editable input for chip rendering
|
|
3
|
+
* and whole-token cursor deletion. Attachment shapes stay in sync with the
|
|
4
|
+
* AttachmentStore placeholder regex in @wrongstack/core:
|
|
5
5
|
* - seq-keyed `[pasted|image|file #N …]` (a cosmetic suffix after the seq,
|
|
6
6
|
* e.g. `, 123 lines`, is tolerated; legacy `[file #N]` is included)
|
|
7
7
|
* - path-keyed `[file:<path>]`
|
|
8
|
+
* `[VIBE]` is a protocol chip: it renders and deletes as a token, but it is
|
|
9
|
+
* not an attachment and must stay in the prompt sent to the refiner/agent.
|
|
8
10
|
*/
|
|
11
|
+
/** Attachment placeholders only. Protocol tags must not be stripped as chips. */
|
|
12
|
+
export declare const ATTACHMENT_TOKEN_SRC = "\\[(?:pasted|image|file) #\\d+[^\\]]*\\]|\\[file:[^\\]]+\\]";
|
|
13
|
+
/** Protocol trigger rendered as a chip but kept in the prompt text. */
|
|
14
|
+
export declare const PROTOCOL_TOKEN_SRC = "\\[VIBE\\]";
|
|
9
15
|
export declare const INLINE_TOKEN_SRC = "\\[(?:pasted|image|file) #\\d+[^\\]]*\\]|\\[file:[^\\]]+\\]|\\[VIBE\\]";
|
|
10
16
|
/**
|
|
11
17
|
* If a whole chip ends immediately before `cursor`, return the buffer and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/tui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.308.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack terminal UI: Ink-based interactive renderer with history, pickers, and slash menus.",
|
|
6
6
|
"repository": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"ink": "7.1.1",
|
|
30
30
|
"react": "^19.2.8",
|
|
31
31
|
"string-width": "8.2.2",
|
|
32
|
-
"@wrongstack/core": "0.
|
|
33
|
-
"@wrongstack/
|
|
34
|
-
"@wrongstack/
|
|
35
|
-
"@wrongstack/
|
|
36
|
-
"@wrongstack/
|
|
37
|
-
"@wrongstack/
|
|
32
|
+
"@wrongstack/core": "0.308.0",
|
|
33
|
+
"@wrongstack/runtime": "0.308.0",
|
|
34
|
+
"@wrongstack/kanban": "0.308.0",
|
|
35
|
+
"@wrongstack/sage": "0.308.0",
|
|
36
|
+
"@wrongstack/tools": "0.308.0",
|
|
37
|
+
"@wrongstack/sdd": "0.308.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@testing-library/dom": "^10.4.1",
|