@dsh-agentic-roleplay/core 0.12.1 → 0.12.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/cordis.patch.yml +108 -0
- package/lib/{access-DifaiHrI.js → access-Csp80TFX.js} +2 -2
- package/lib/{authoring-tools-VOaXzr_R.js → authoring-tools-BZr4bgBy.js} +9 -7
- package/lib/authoring.js +9 -8
- package/lib/{child-DzZ-aI6k.js → child-DTdY14S9.js} +45 -6
- package/lib/client.js +820 -561
- package/lib/client.js.map +1 -1
- package/lib/compaction.js +3 -3
- package/lib/{dev-context-Bdm-eVer.js → dev-context-Cgv_wZbG.js} +12 -2
- package/lib/doctor.js +5 -4
- package/lib/{gallery-Ctz-UoFk.js → gallery-BNg0rPTp.js} +3 -3
- package/lib/{generator-Cv6WWmZT.js → generator-9-5at9cZ.js} +2 -2
- package/lib/helper.js +4 -10
- package/lib/{hooks-BdR3mBeM.js → hooks-Dtq5KZQX.js} +19 -7
- package/lib/images.js +4 -4
- package/lib/index.js +39 -28
- package/lib/{jail-Cp4zEfip.js → jail-DVbPSC0R.js} +2 -2
- package/lib/{library-BU2A_Dx8.js → library-DTxakw0z.js} +2 -2
- package/lib/{lorebook-author-tools-DUKcQu8P.js → lorebook-author-tools-BjcEUo22.js} +6 -6
- package/lib/lorebook-authoring.js +7 -6
- package/lib/{narration-CDsJ5wxH.js → narration--K2XVIHI.js} +2 -2
- package/lib/orchestration.js +12 -12
- package/lib/{pack-jail-CzHQu0n3.js → pack-jail-Dt0VTsu0.js} +11 -11
- package/lib/{packs-BZ-45J4-.js → packs-DWfR2Ted.js} +2 -2
- package/lib/{presenter-agent-C2ZkoxZu.js → presenter-agent-vFOxIuWv.js} +6 -6
- package/lib/{preset-BPnRPW-1.js → preset-Dv5YF2qj.js} +4 -4
- package/lib/{preset-author-tools-DBqPwn-o.js → preset-author-tools-BUzO9mTW.js} +6 -6
- package/lib/preset-authoring.js +7 -6
- package/lib/{reflection-Cuy0YLv0.js → reflection-Dd3pEiZB.js} +7 -7
- package/lib/{serial-BZNeK57v.js → serial-BUaJGwVy.js} +67 -7
- package/lib/{turn-guard-xaFxYc1T.js → turn-guard-87NE-Cnp.js} +3 -3
- package/package.json +3 -3
package/cordis.patch.yml
CHANGED
|
@@ -1,3 +1,111 @@
|
|
|
1
|
+
# A complete roleplay installation. The core and all packages ship identical layers.
|
|
1
2
|
- insert:
|
|
3
|
+
- id: roleplay-state
|
|
4
|
+
name: '@dsh-agentic-roleplay/state'
|
|
2
5
|
- id: roleplay
|
|
3
6
|
name: '@dsh-agentic-roleplay/core'
|
|
7
|
+
# Roleplay chats receive their tools and instructions from orchestration.
|
|
8
|
+
- id: preset-roleplay
|
|
9
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
10
|
+
config:
|
|
11
|
+
id: roleplay
|
|
12
|
+
name: Role Play
|
|
13
|
+
description: Play interactive stories with character agents, persistent world state, memory, and roleplay tools.
|
|
14
|
+
plugins:
|
|
15
|
+
- id: persona
|
|
16
|
+
name: '@deepseek-ai/dsh-persona'
|
|
17
|
+
config:
|
|
18
|
+
prefix: ''
|
|
19
|
+
suffix: ''
|
|
20
|
+
- id: orchestration
|
|
21
|
+
name: '@dsh-agentic-roleplay/core/orchestration'
|
|
22
|
+
# Folds the oldest turns of a long conversation into summaries written
|
|
23
|
+
# from the story's recorded events, at the limit set per chat.
|
|
24
|
+
- id: compaction
|
|
25
|
+
name: cordis:group
|
|
26
|
+
group: true
|
|
27
|
+
isolate:
|
|
28
|
+
compaction: true
|
|
29
|
+
config:
|
|
30
|
+
- id: roleplay-compaction
|
|
31
|
+
name: '@dsh-agentic-roleplay/core/compaction'
|
|
32
|
+
# Helpers receive role-specific tools when they start.
|
|
33
|
+
- id: preset-roleplay-helper
|
|
34
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
35
|
+
config:
|
|
36
|
+
id: roleplay-helper
|
|
37
|
+
name: Role Play Helper
|
|
38
|
+
description: Internal preset used by roleplay characters and supporting agents during a story.
|
|
39
|
+
plugins:
|
|
40
|
+
- id: persona
|
|
41
|
+
name: '@deepseek-ai/dsh-persona'
|
|
42
|
+
config:
|
|
43
|
+
prefix: ''
|
|
44
|
+
suffix: ''
|
|
45
|
+
- id: helper
|
|
46
|
+
name: '@dsh-agentic-roleplay/core/helper'
|
|
47
|
+
# File tools are jailed to interface packs and writes require approval.
|
|
48
|
+
- id: preset-world-authoring
|
|
49
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
50
|
+
config:
|
|
51
|
+
id: world-authoring
|
|
52
|
+
name: World Authoring
|
|
53
|
+
description: Create and refine roleplay worlds, characters, rules, and interface packs with guided authoring tools.
|
|
54
|
+
plugins:
|
|
55
|
+
- id: persona
|
|
56
|
+
name: '@deepseek-ai/dsh-persona'
|
|
57
|
+
config:
|
|
58
|
+
prefix: ''
|
|
59
|
+
suffix: ''
|
|
60
|
+
- id: tool-fs
|
|
61
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
62
|
+
config:
|
|
63
|
+
applyPatch: false
|
|
64
|
+
- id: authoring
|
|
65
|
+
name: '@dsh-agentic-roleplay/core/authoring'
|
|
66
|
+
- id: preset-preset-authoring
|
|
67
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
68
|
+
config:
|
|
69
|
+
id: preset-authoring
|
|
70
|
+
name: Preset Authoring
|
|
71
|
+
description: Edit the reusable prose instructions that shape how a roleplay world is narrated and played.
|
|
72
|
+
plugins:
|
|
73
|
+
- id: persona
|
|
74
|
+
name: '@deepseek-ai/dsh-persona'
|
|
75
|
+
config:
|
|
76
|
+
prefix: ''
|
|
77
|
+
suffix: ''
|
|
78
|
+
- id: preset-authoring
|
|
79
|
+
name: '@dsh-agentic-roleplay/core/preset-authoring'
|
|
80
|
+
- id: preset-lorebook-authoring
|
|
81
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
82
|
+
config:
|
|
83
|
+
id: lorebook-authoring
|
|
84
|
+
name: Lorebook Authoring
|
|
85
|
+
description: Build and revise reusable lorebook entries for characters, places, history, and other world knowledge.
|
|
86
|
+
plugins:
|
|
87
|
+
- id: persona
|
|
88
|
+
name: '@deepseek-ai/dsh-persona'
|
|
89
|
+
config:
|
|
90
|
+
prefix: ''
|
|
91
|
+
suffix: ''
|
|
92
|
+
- id: lorebook-authoring
|
|
93
|
+
name: '@dsh-agentic-roleplay/core/lorebook-authoring'
|
|
94
|
+
- id: preset-session-doctor
|
|
95
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
96
|
+
config:
|
|
97
|
+
id: session-doctor
|
|
98
|
+
name: Session Doctor
|
|
99
|
+
description: Inspect a roleplay session for record problems and propose player-approved repairs.
|
|
100
|
+
plugins:
|
|
101
|
+
- id: persona
|
|
102
|
+
name: '@deepseek-ai/dsh-persona'
|
|
103
|
+
config:
|
|
104
|
+
prefix: ''
|
|
105
|
+
suffix: ''
|
|
106
|
+
- id: doctor
|
|
107
|
+
name: '@dsh-agentic-roleplay/core/doctor'
|
|
108
|
+
# Allows one character round and its supporting helpers to run concurrently.
|
|
109
|
+
- id: subagent
|
|
110
|
+
config:
|
|
111
|
+
maxActiveSubagents: 32
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as roleplaySessionOf } from "./child-
|
|
1
|
+
import { j as roleplaySessionOf } from "./child-DTdY14S9.js";
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
3
|
import { chmodSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -183,4 +183,4 @@ function promptFor(agent, id, language, variables) {
|
|
|
183
183
|
}
|
|
184
184
|
export { VARIABLE_KINDS as a, atomicWriteSync as i, atomicWrite as n, VARIABLE_SUBJECTS as o, atomicWriteJson as r, VARIABLE_VISIBILITIES as s, promptFor as t };
|
|
185
185
|
|
|
186
|
-
//# sourceMappingURL=access-
|
|
186
|
+
//# sourceMappingURL=access-Csp80TFX.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { T as currentTurn, c as namedModel, l as runChild, m as parseSampling, t as ChildTimeoutError } from "./child-
|
|
2
|
-
import { $t as subfolders, Bt as loadLore, C as ROLE_TABLE, Ct as PICTURE_FILE, E as askYesNo, Et as readImportFolder, Ft as VARIABLES_FILE_NAME, Gt as ITEM_FILE_NAME, Ht as parseLoreFile, It as loadVariables, Jt as parseSlotsFile, Kt as SLOTS_FILE_NAME, M as WORLD_FILE_NAME, Mt as splitPanels, N as parseWorldFile, Nt as dialectOf, Qt as parseCharacterFile, R as startQuestionsToFile, Rt as variableProblems, S as ROLES, Ut as LOCATION_FILE_NAME, Vt as LORE_FILE_NAME, Wt as parseLocationFile, Xt as parseFactionFile, Yt as FACTION_FILE_NAME, Zt as CHARACTER_FILE_NAME, _ as pruneRelationships, _t as itemise, a as characterDocument, b as classifyItems, bt as IMPORT_FOLDER, c as extractStyle, d as inert, dn as DEFAULT_SLOTS, en as InvalidEditProblems, f as loreDocuments, g as pruneMembers, gt as cleanText, h as pruneLoreSubjects, i as asWritten, j as yesAt, jt as findPanel, k as noAt, kt as parseImportCommand, m as pruneLinks, o as emptyExtracted, p as pruneKnowledge, qt as parseItemFile, r as addLore, s as extractEntities, sn as guarded, t as SerialQueue, u as extractVariables, un as WEEKDAY_NAMES, v as sourcesFor, w as isLeftOut, wt as openingText, x as findEntity, y as buildRoster, yt as withPlayer, zt as LORE_DIR } from "./serial-
|
|
3
|
-
import { f as parseSwitchboard } from "./narration
|
|
4
|
-
import { n as atomicWrite, r as atomicWriteJson } from "./access-
|
|
5
|
-
import { G as readDocument$1, J as errorMessage, K as Reader,
|
|
1
|
+
import { T as currentTurn, c as namedModel, l as runChild, m as parseSampling, t as ChildTimeoutError } from "./child-DTdY14S9.js";
|
|
2
|
+
import { $t as subfolders, Bt as loadLore, C as ROLE_TABLE, Ct as PICTURE_FILE, E as askYesNo, Et as readImportFolder, Ft as VARIABLES_FILE_NAME, Gt as ITEM_FILE_NAME, Ht as parseLoreFile, It as loadVariables, Jt as parseSlotsFile, Kt as SLOTS_FILE_NAME, M as WORLD_FILE_NAME, Mt as splitPanels, N as parseWorldFile, Nt as dialectOf, Qt as parseCharacterFile, R as startQuestionsToFile, Rt as variableProblems, S as ROLES, Ut as LOCATION_FILE_NAME, Vt as LORE_FILE_NAME, Wt as parseLocationFile, Xt as parseFactionFile, Yt as FACTION_FILE_NAME, Zt as CHARACTER_FILE_NAME, _ as pruneRelationships, _t as itemise, a as characterDocument, b as classifyItems, bt as IMPORT_FOLDER, c as extractStyle, d as inert, dn as DEFAULT_SLOTS, en as InvalidEditProblems, f as loreDocuments, g as pruneMembers, gt as cleanText, h as pruneLoreSubjects, i as asWritten, j as yesAt, jt as findPanel, k as noAt, kt as parseImportCommand, m as pruneLinks, o as emptyExtracted, p as pruneKnowledge, qt as parseItemFile, r as addLore, s as extractEntities, sn as guarded, t as SerialQueue, u as extractVariables, un as WEEKDAY_NAMES, v as sourcesFor, w as isLeftOut, wt as openingText, x as findEntity, y as buildRoster, yt as withPlayer, zt as LORE_DIR } from "./serial-BUaJGwVy.js";
|
|
3
|
+
import { f as parseSwitchboard } from "./narration--K2XVIHI.js";
|
|
4
|
+
import { n as atomicWrite, r as atomicWriteJson } from "./access-Csp80TFX.js";
|
|
5
|
+
import { $ as copyWorldPrompts, G as readDocument$1, J as errorMessage, K as Reader, U as commandFlagKey, V as plotReferenceProblems, Z as PROMPTS_FOLDER, a as externalGiven, it as shippedLanguages, lt as InvalidWorldError, nt as listFiles, ot as shippedText, q as formatIssue, rt as promptProblem, s as externalWithheld, t as externalToolLimit, vt as COMPARISONS, z as loadPlots } from "./hooks-Dtq5KZQX.js";
|
|
6
6
|
import { t as trimCharacters } from "./text-Dfv8S8eq.js";
|
|
7
|
-
import { C as slug, S as norm, T as uniqueKey, _ as writeImageFileMetadata, b as NoEmbeddingService, i as libraryHashes, n as addToLibraryOnce, p as MEDIA_TYPES, r as imageExtensionOf, u as referenceImagePath, w as trOf, x as mapLimit } from "./library-
|
|
7
|
+
import { C as slug, S as norm, T as uniqueKey, _ as writeImageFileMetadata, b as NoEmbeddingService, i as libraryHashes, n as addToLibraryOnce, p as MEDIA_TYPES, r as imageExtensionOf, u as referenceImagePath, w as trOf, x as mapLimit } from "./library-DTxakw0z.js";
|
|
8
8
|
import { join, relative, sep } from "node:path";
|
|
9
9
|
import { MINUTE, MONTH_NAMES, SEASONS, checkProblems, createSessionStore, dayTokenProblems, lintWorld, parseTimeOfDay, readTriggerDefinition, triggerReferenceProblems, writeCalendar } from "@dsh-agentic-roleplay/state";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
@@ -3393,6 +3393,7 @@ function infoOf(document, startQuestions = []) {
|
|
|
3393
3393
|
authorUrl: textOf(author["url"]),
|
|
3394
3394
|
timeZone: textOf(document["time_zone"]),
|
|
3395
3395
|
startingTime: textOf(document["starting_time"]),
|
|
3396
|
+
language: textOf(document["language"]),
|
|
3396
3397
|
preset: textOf(document["preset"]),
|
|
3397
3398
|
lorebooks: Array.isArray(document["lorebooks"]) ? document["lorebooks"].filter((name) => typeof name === "string") : [],
|
|
3398
3399
|
version: typeof document["version"] === "number" ? String(document["version"]) : textOf(document["version"]),
|
|
@@ -3469,6 +3470,7 @@ async function changeWorldInfo(directory, edit) {
|
|
|
3469
3470
|
if (edit.timeZone !== void 0) setOrRemove(document, "time_zone", edit.timeZone);
|
|
3470
3471
|
if (edit.startingTime !== void 0) setOrRemove(document, "starting_time", edit.startingTime);
|
|
3471
3472
|
if (edit.version !== void 0) setOrRemove(document, "version", edit.version);
|
|
3473
|
+
if (edit.language !== void 0) setOrRemove(document, "language", edit.language);
|
|
3472
3474
|
if (edit.preset !== void 0) setOrRemove(document, "preset", edit.preset);
|
|
3473
3475
|
if (edit.lorebooks !== void 0) {
|
|
3474
3476
|
if (edit.lorebooks.length === 0) delete document["lorebooks"];
|
|
@@ -6221,4 +6223,4 @@ function limitAuthoringAgents(ctx, kindOf) {
|
|
|
6221
6223
|
}
|
|
6222
6224
|
export { readSource as $, editsSince as A, loadCommands as At, addressesToFetch as B, isPng as Bt, worldFieldChanges as C, FACTIONS_DIR as Ct, loadCardEvidence as D, parseDiceFile as Dt, loadWorldParts as E, loadDice as Et, localChanges as F, CHARACTERS_DIR as Ft, vetUrl as G, DICE_RESULTS as Gt, fetchPictures as H, readCard as Ht, readOrigin as I, loadCharacters as It, UPDATE_FOLDER as J, cardCharacter as K, authoredWorldOf as Kt, writeOrigin as L, knownOutputCeiling as Lt, describeChanges as M, CALENDAR_FILE_NAME as Mt, hashWorld as N, loadCalendar as Nt, CHECK_COMMANDS as O, COMMANDS_FILE_NAME as Ot, isUnchanged as P, parseCalendarFile as Pt, entitiesByPiece as Q, CatalogueError as R, ImportCardError as Rt, pictureChange as S, loadItems as St, readWorldInfo as T, DICE_FILE_NAME as Tt, guardedLookup as U, DICE_COMPARISONS as Ut, candidateUrls as V, pictureOf as Vt, mergeReports as W, DICE_READINGS as Wt, cardPieces as X, baseId as Y, cardTools as Z, runChecks as _, TRIGGERS_FILE_NAME as _t, importHooks as a, populateCharacters as at, diffText as b, loadLocations as bt, importPhase as c, populateFactions as ct, markReady as d, populateLocations as dt, checkWorld as et, settleDraft as f, populateLore as ft, CHECKS as g, routineProblems as gt, presentReport as h, populateVariables as ht, contextOf as i, populateCalendar as it, writeSnapshot as j, parseCommandsFile as jt, recordProvenance as k, commandVariable as kt, isReviewing as l, populateItems as lt, checkImported as m, populateTriggers as mt, limitAuthoringAgents as n, withScratchStory as nt, importTools as o, populateClock as ot, structureImport as p, populateRoutines as pt, writePortrait as q, authoringChatSessionId as qt, MAX_PREVIEW_TEXT as r, knowsCharacter as rt, worldOf as s, populateDice as st, AuthoringTools as t, loadValidatedWorld as tt, keepDraft as u, populateKnowledge as ut, addressChanges as v, loadTriggers as vt, editWorldInfo as w, loadFactions as wt, matchPieces as x, ITEMS_DIR as xt, cardChanges as y, LOCATIONS_DIR as yt, addressKey as z, cardFormat as zt };
|
|
6223
6225
|
|
|
6224
|
-
//# sourceMappingURL=authoring-tools-
|
|
6226
|
+
//# sourceMappingURL=authoring-tools-BZr4bgBy.js.map
|
package/lib/authoring.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as readSource, A as editsSince, C as worldFieldChanges, D as loadCardEvidence, E as loadWorldParts, J as UPDATE_FOLDER, Kt as authoredWorldOf, Mt as CALENDAR_FILE_NAME, O as CHECK_COMMANDS, Ot as COMMANDS_FILE_NAME, Q as entitiesByPiece, S as pictureChange, T as readWorldInfo, Tt as DICE_FILE_NAME, Z as cardTools, _ as runChecks, a as importHooks, b as diffText, et as checkWorld, g as CHECKS, h as presentReport, i as contextOf, l as isReviewing, m as checkImported, n as limitAuthoringAgents, o as importTools, v as addressChanges, w as editWorldInfo, x as matchPieces, y as cardChanges } from "./authoring-tools-
|
|
2
|
-
import { t as guardAuthoringTurns } from "./turn-guard-
|
|
3
|
-
import { t as silenceHarnessDevContext } from "./dev-context-
|
|
4
|
-
import { B as deleteTriggerDocument, D as editWorldPlots, G as parseVariablesEdit, H as writeTriggerDocument, K as parseDiceEdit, M as readWorldEditor, O as editWorldRelation, Q as translateTools, U as parseCalendarEdit, V as readTriggerDocuments, X as presetTools, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, f as editCalendar, g as editVariables, i as checkWorldPack, l as deleteAuthoredEntity, m as editDice, nt as finishUpdate, o as listWorldPacks, p as editCommands, q as parseCommandsEdit, r as registerPackJail, rt as pendingUpdate, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument } from "./pack-jail-
|
|
1
|
+
import { $ as readSource, A as editsSince, C as worldFieldChanges, D as loadCardEvidence, E as loadWorldParts, J as UPDATE_FOLDER, Kt as authoredWorldOf, Mt as CALENDAR_FILE_NAME, O as CHECK_COMMANDS, Ot as COMMANDS_FILE_NAME, Q as entitiesByPiece, S as pictureChange, T as readWorldInfo, Tt as DICE_FILE_NAME, Z as cardTools, _ as runChecks, a as importHooks, b as diffText, et as checkWorld, g as CHECKS, h as presentReport, i as contextOf, l as isReviewing, m as checkImported, n as limitAuthoringAgents, o as importTools, v as addressChanges, w as editWorldInfo, x as matchPieces, y as cardChanges } from "./authoring-tools-BZr4bgBy.js";
|
|
2
|
+
import { t as guardAuthoringTurns } from "./turn-guard-87NE-Cnp.js";
|
|
3
|
+
import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
|
|
4
|
+
import { B as deleteTriggerDocument, D as editWorldPlots, G as parseVariablesEdit, H as writeTriggerDocument, K as parseDiceEdit, M as readWorldEditor, O as editWorldRelation, Q as translateTools, U as parseCalendarEdit, V as readTriggerDocuments, X as presetTools, a as deleteWorldPackFile, c as createAuthoredEntity, d as replaceAuthoredEntity, f as editCalendar, g as editVariables, i as checkWorldPack, l as deleteAuthoredEntity, m as editDice, nt as finishUpdate, o as listWorldPacks, p as editCommands, q as parseCommandsEdit, r as registerPackJail, rt as pendingUpdate, s as AUTHORED_ENTITY_KINDS, u as readAuthoredEntityDocument } from "./pack-jail-Dt0VTsu0.js";
|
|
5
5
|
import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
|
|
6
|
-
import { $ as deleteWorldPrompt, At as parseAuthoringCommand, Ct as PICTURE_FILE, F as parseWorldInfoEdit, Ft as VARIABLES_FILE_NAME, Q as PROSE_PROMPTS, an as parseRelationEdit, bt as IMPORT_FOLDER, en as InvalidEditProblems, et as listWorldPrompts, nt as writeWorldPrompt, tt as readWorldPrompt } from "./serial-
|
|
7
|
-
import { B as parsePlotsFile,
|
|
8
|
-
import { g as SURFACE_NAMES, m as PACK_LIMITS, p as PACK_ACTIONS } from "./packs-
|
|
9
|
-
import "./access-
|
|
6
|
+
import { $ as deleteWorldPrompt, At as parseAuthoringCommand, Ct as PICTURE_FILE, F as parseWorldInfoEdit, Ft as VARIABLES_FILE_NAME, Q as PROSE_PROMPTS, an as parseRelationEdit, bt as IMPORT_FOLDER, en as InvalidEditProblems, et as listWorldPrompts, nt as writeWorldPrompt, tt as readWorldPrompt } from "./serial-BUaJGwVy.js";
|
|
7
|
+
import { B as parsePlotsFile, at as shippedPromptsDirectory, q as formatIssue } from "./hooks-Dtq5KZQX.js";
|
|
8
|
+
import { g as SURFACE_NAMES, m as PACK_LIMITS, p as PACK_ACTIONS } from "./packs-DWfR2Ted.js";
|
|
9
|
+
import "./access-Csp80TFX.js";
|
|
10
10
|
import { join, relative } from "node:path";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { readFile, readdir } from "node:fs/promises";
|
|
@@ -1373,6 +1373,7 @@ const inject = [
|
|
|
1373
1373
|
];
|
|
1374
1374
|
function apply(ctx) {
|
|
1375
1375
|
silenceHarnessDevContext(ctx);
|
|
1376
|
+
silenceRuntimeContext(ctx);
|
|
1376
1377
|
const prompting = {
|
|
1377
1378
|
prompts: () => ctx.roleplayPrompts,
|
|
1378
1379
|
languages: () => ctx.roleplayAuthoringLanguages
|
|
@@ -477,8 +477,14 @@ const isUnfinishedCall = (error) => error instanceof Error && /parse tool call a
|
|
|
477
477
|
* lets {@link HelperEntry.setup} give it tools of its own. Several run side by side with different tools and different results from the same tool.
|
|
478
478
|
* @throws {Error} when the child is cancelled, stops without a result, or exceeds its calls.
|
|
479
479
|
*/
|
|
480
|
-
async function runChild(
|
|
481
|
-
|
|
480
|
+
async function runChild(asked) {
|
|
481
|
+
let task = asked;
|
|
482
|
+
let unfinished = 0;
|
|
483
|
+
for (;;) {
|
|
484
|
+
if (task.structured === true && hidesAnswers.has(modelOf(task))) task = {
|
|
485
|
+
...task,
|
|
486
|
+
structured: false
|
|
487
|
+
};
|
|
482
488
|
const began = Date.now();
|
|
483
489
|
const turnAtStart = task.turn ?? currentTurn(task.parent);
|
|
484
490
|
const stats = {
|
|
@@ -522,12 +528,34 @@ async function runChild(task) {
|
|
|
522
528
|
tokens: stats.tokens ?? NO_TOKENS,
|
|
523
529
|
requests: stats.requests ?? []
|
|
524
530
|
});
|
|
525
|
-
if (
|
|
531
|
+
if (task.signal.aborted) throw error;
|
|
532
|
+
if (task.structured === true && error instanceof Error && error.message === "the reply is empty: the answer was written as thinking, which this endpoint does with a constrained reply while the model thinks") {
|
|
533
|
+
const model = modelOf(task);
|
|
534
|
+
if (model !== "") hidesAnswers.add(model);
|
|
535
|
+
task = {
|
|
536
|
+
...task,
|
|
537
|
+
structured: false
|
|
538
|
+
};
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
unfinished += 1;
|
|
542
|
+
if (unfinished >= 2 || error instanceof ChildTimeoutError || !isUnfinishedCall(error)) throw error;
|
|
526
543
|
} finally {
|
|
527
544
|
if (timer !== void 0) clearTimeout(timer);
|
|
528
545
|
}
|
|
529
546
|
}
|
|
530
547
|
}
|
|
548
|
+
/** Models known to return constrained output only in their reasoning block. */
|
|
549
|
+
const hidesAnswers = /* @__PURE__ */ new Set();
|
|
550
|
+
/** The selected model as `provider/model`, or an empty string when it is unknown. */
|
|
551
|
+
function modelOf(task) {
|
|
552
|
+
const config = task.model === void 0 ? task.parent.session.requestHeader?.()?.config : void 0;
|
|
553
|
+
const model = task.model ?? (config?.provider === void 0 || config.model === void 0 ? void 0 : {
|
|
554
|
+
provider: config.provider,
|
|
555
|
+
model: config.model
|
|
556
|
+
});
|
|
557
|
+
return model === void 0 ? "" : `${model.provider}/${model.model}`;
|
|
558
|
+
}
|
|
531
559
|
/**
|
|
532
560
|
* The thinking level a child may be given on its model: the one asked for when the model offers it, none when it does not (a model chosen for a
|
|
533
561
|
* helper has its own levels, and one that lacks the level the chat asks for would refuse the request).
|
|
@@ -575,11 +603,14 @@ function repairedJson(text, accepts = () => true) {
|
|
|
575
603
|
}
|
|
576
604
|
}
|
|
577
605
|
}
|
|
606
|
+
/** A constrained result was returned only as reasoning, leaving the answer empty. */
|
|
607
|
+
const ANSWERED_IN_THINKING = "the reply is empty: the answer was written as thinking, which this endpoint does with a constrained reply while the model thinks";
|
|
578
608
|
/** The result in the last reply of a structured child: its JSON, which must fit the schema; else what is wrong with it. */
|
|
579
609
|
function structuredReply(child, schema, cut = false) {
|
|
580
610
|
const message = child.session.snapshotEvents().findLast((event) => event.type === "assistant/message");
|
|
581
|
-
const
|
|
582
|
-
|
|
611
|
+
const content = message?.type === "assistant/message" ? message.data.message.content : [];
|
|
612
|
+
const text = content.flatMap((block) => block.type === "text" ? [block.text] : []).join("").trim().replace(/^```(?:json)?\s*|\s*```$/g, "");
|
|
613
|
+
if (text === "") return { problem: content.some((block) => block.type === "reasoning" && block.text.trim() !== "") ? ANSWERED_IN_THINKING : "the reply is empty" };
|
|
583
614
|
let value;
|
|
584
615
|
try {
|
|
585
616
|
value = JSON.parse(text);
|
|
@@ -609,6 +640,7 @@ async function execute(task, stats) {
|
|
|
609
640
|
let stepsAfterRetire = -1;
|
|
610
641
|
let overran = false;
|
|
611
642
|
let rambled = false;
|
|
643
|
+
let hidden = false;
|
|
612
644
|
let refusals = 0;
|
|
613
645
|
let lastRefusal = "";
|
|
614
646
|
let previous;
|
|
@@ -785,6 +817,12 @@ async function execute(task, stats) {
|
|
|
785
817
|
outcome: cut(lastRefusal),
|
|
786
818
|
failed: true
|
|
787
819
|
});
|
|
820
|
+
if (lastRefusal === "the reply is empty: the answer was written as thinking, which this endpoint does with a constrained reply while the model thinks") {
|
|
821
|
+
hidden = true;
|
|
822
|
+
overran = true;
|
|
823
|
+
stopped?.();
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
788
826
|
if (refusals >= 5) {
|
|
789
827
|
overran = true;
|
|
790
828
|
stopped?.();
|
|
@@ -910,6 +948,7 @@ async function execute(task, stats) {
|
|
|
910
948
|
}
|
|
911
949
|
if (signal.aborted) throw new Error("cancelled");
|
|
912
950
|
if (rambled && submitted === void 0) throw new Error(`the agent wrote text up to the limit of ${task.maxTokens ?? task.sampling?.maxTokens ?? "its model"} tokens and never called ${SUBMIT_TOOL}, and was stopped`);
|
|
951
|
+
if (hidden && submitted === void 0) throw new Error(ANSWERED_IN_THINKING);
|
|
913
952
|
if (overran && submitted === void 0) throw new Error(refusals >= 5 ? `the result was refused ${refusals} times and the agent was stopped; the last reason: ${lastRefusal}` : `the agent went on past its ${budget} calls, or kept repeating a call that failed, without submitting a result and was stopped`);
|
|
914
953
|
if (submitted === void 0) {
|
|
915
954
|
const ended = entry.agent?.session.snapshotEvents().findLast((event) => event.type === "turn/end");
|
|
@@ -921,4 +960,4 @@ async function execute(task, stats) {
|
|
|
921
960
|
}
|
|
922
961
|
export { chatSessionId as A, addTokens as C, finishOf as D, cutOff as E, estimateAnswer as O, NO_TOKENS as S, currentTurn as T, RECOVERY_SHRINK as _, childTrace as a, estimateTokens as b, namedModel as c, sessionOfChat as d, tracerOf as f, RECOVERY_FLOOR as g, sharedSamplingOf as h, childSamplingOf as i, roleplaySessionOf as j, tokensOf$1 as k, runChild as l, parseSampling as m, childModel as n, helpers as o, SAMPLING_RANGES as p, childSampling as r, isUnfinishedCall as s, ChildTimeoutError as t, TurnTraces as u, requestsOf as v, totalTokens as w, tokensOf as x, blockText as y };
|
|
923
962
|
|
|
924
|
-
//# sourceMappingURL=child-
|
|
963
|
+
//# sourceMappingURL=child-DTdY14S9.js.map
|