@lmzhen/dsh-evolution-core 0.3.76 → 0.3.77
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/lib/index.js +45 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/opt-in.d.ts +62 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7367,4 +7367,48 @@ function newSkillLibrary(options) {
|
|
|
7367
7367
|
} : void 0, transact, [...threatExemptLabels ?? []]);
|
|
7368
7368
|
}
|
|
7369
7369
|
//#endregion
|
|
7370
|
-
|
|
7370
|
+
//#region lib/types/opt-in.js
|
|
7371
|
+
/**
|
|
7372
|
+
* Tool names only a session that mounted the family's MODEL rows can see.
|
|
7373
|
+
*
|
|
7374
|
+
* Both are family packages (`tool-skill-manage`, `tool-memory`), so a session
|
|
7375
|
+
* that merely carries the platform's own session-query tool is not mistaken for
|
|
7376
|
+
* a family session. Two names, not one: a deployment may disable either row.
|
|
7377
|
+
*/
|
|
7378
|
+
const FAMILY_SESSION_TOOL_NAMES = ["skill_manage", "memory"];
|
|
7379
|
+
/**
|
|
7380
|
+
* Does this session's scope see the family's model tools?
|
|
7381
|
+
*
|
|
7382
|
+
* The scope is the live agent's — the platform's own addressing for "what does
|
|
7383
|
+
* this session see" (`tools.get(name, scope)`, packages/core/tools/src/index.ts:1194).
|
|
7384
|
+
* A session with no live agent (a finished or cold session) has no scope to ask
|
|
7385
|
+
* in, so it resolves to false; the consumers this gate serves only run for live
|
|
7386
|
+
* agents.
|
|
7387
|
+
* @param ctx - a context of the runtime (any plane; the services are read from the global store).
|
|
7388
|
+
* @param sessionId - the session to ask about.
|
|
7389
|
+
* @returns true when at least one family model tool is visible to that session.
|
|
7390
|
+
*/
|
|
7391
|
+
function sessionSeesFamilyTools(ctx, sessionId) {
|
|
7392
|
+
const probe = ctx;
|
|
7393
|
+
const tools = probe.get("tools");
|
|
7394
|
+
if (tools === void 0) return false;
|
|
7395
|
+
const agent = probe.get("agents")?.get(sessionId);
|
|
7396
|
+
const scope = agent?.ctx === void 0 ? void 0 : scopeOf(agent.ctx);
|
|
7397
|
+
return FAMILY_SESSION_TOOL_NAMES.some((name) => tools.get(name, scope) !== void 0);
|
|
7398
|
+
}
|
|
7399
|
+
/**
|
|
7400
|
+
* The one decision every cross-session consumer calls before it acts.
|
|
7401
|
+
* @param ctx - a context of the runtime.
|
|
7402
|
+
* @param sessionId - the session the event belongs to.
|
|
7403
|
+
* @param sessionScoped - the row's `sessionScoped` config.
|
|
7404
|
+
* @returns true when the consumer may act on this session. A deployment that did
|
|
7405
|
+
* not declare session scoping always answers true (the historical behavior);
|
|
7406
|
+
* a scoped one answers true only for a session that carries the family's model
|
|
7407
|
+
* tools.
|
|
7408
|
+
*/
|
|
7409
|
+
function sessionAudited(ctx, sessionId, sessionScoped) {
|
|
7410
|
+
if (sessionScoped !== true) return true;
|
|
7411
|
+
return sessionSeesFamilyTools(ctx, sessionId);
|
|
7412
|
+
}
|
|
7413
|
+
//#endregion
|
|
7414
|
+
export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEAD_LOCK_TAKEOVER_MS, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MEMORY_REVIEW_MODEL, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_CONTEXT_MESSAGES, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_MESSAGE_CHARS, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_MODEL, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, DISPATCH_EVENT_TYPES, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, EMPTY_LOCK_TAKEOVER_MS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_WRITE_TOOLS, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, HEALTH_STAMP_RE, LOCK_BODY_RE, LOCK_SUFFIX, LOCK_TEAR_TAKEOVER_MS, LOW_QUALITY_THRESHOLD, LostWriteLock, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MAX_TIMER_DELAY_MS, MEMORY_GUIDANCE_SECTION_ORDER, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MUTATIONS_FILE_VERSION, MemoryStore, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PATTERN_OVERLAP, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, PTC_DISPATCH_EVENT, PTC_DISPATCH_START_EVENT, QUALITY_WEIGHTS, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, THREAT_EXEMPTION_HINT, ToolDispatchNormalizer, ToolDispatchPayloadError, advanceReview, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, assertDispatchPayload, assertSkillsRootAliasRetired, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, callingScope, clampedNumber, clearReviewChannel, collectReadSkillNames, composePresetComposition, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, countDispatches, createGateSet, decideTakeover, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionEventPayloadIssue, evolutionHome, evolutionIoAdapter, evolutionRoot, findDriftSignal, foldCuratorFields, foldToolDispatches, foldTurn, frontmatterBlock, frontmatterCatalogInvalid, getRecord, isAbsent, isCommittedWarning, isGlobalRead, isPresent, isProcessAlive, isProgramToolName, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, mapProbe, markAgentCreated, markReviewChannel, markerEntryName, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, neutralizePromptVariables, newSkillLibrary, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, parseLockBody, pendingSelfCleanup, probeAbsent, probePresent, probeUnknown, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renameWithRetry, renderCuratorReportMarkdown, resolveOrigins, resolveRootConfig, resolveSkillsRoot, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, sessionAudited, sessionSeesFamilyTools, skillReadNameOf, skillsRoot, suppressedFile, sweepReviewChannelSessions, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, validateRestructureTarget, valueOr, verifyPromptBundle, writeDurableTmp, yamlPlainScalarNeedsQuotes };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variant-form opt-in: WHICH sessions the family's cross-session consumers act on.
|
|
3
|
+
*
|
|
4
|
+
* The family ships in two install forms. Mounted onto the original presets (the
|
|
5
|
+
* profile-level bundle), EVERY session is a family session and the consumers
|
|
6
|
+
* below keep acting on all of them. In the VARIANT form the family's model tools
|
|
7
|
+
* exist only inside a variant preset, so a session that did not select one never
|
|
8
|
+
* opted in — yet the cross-session consumers (review cadence and injection,
|
|
9
|
+
* skill-usage telemetry) live at profile root and used to act on every session
|
|
10
|
+
* anyway, including the platform's original presets: a user who installed a
|
|
11
|
+
* variant was still injected with review prompts and still counted in usage.
|
|
12
|
+
*
|
|
13
|
+
* The two forms are told apart WITHOUT a list of preset ids and WITHOUT a second
|
|
14
|
+
* source of truth: a session is a family session exactly when the family's own
|
|
15
|
+
* model tools are visible in its scope. Mounted at profile root they are visible
|
|
16
|
+
* to every session; mounted inside a variant preset they are visible only to the
|
|
17
|
+
* agents that joined that preset's standing scope — every registration inside a
|
|
18
|
+
* preset files into that agent's layer
|
|
19
|
+
* (packages/preset/agent-presets/src/mount.ts:4-13).
|
|
20
|
+
*
|
|
21
|
+
* `sessionScoped` is what a deployment declares: true means "act only on a
|
|
22
|
+
* session that carries the family's model tools", which is the right question in
|
|
23
|
+
* BOTH install forms — at profile root every session carries them, inside a
|
|
24
|
+
* variant preset only the sessions that selected one do. The shipped bundles set
|
|
25
|
+
* it; a bare library mount and the host-only infrastructure mode leave it false
|
|
26
|
+
* and keep the historical "every session" behavior.
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
30
|
+
/**
|
|
31
|
+
* Tool names only a session that mounted the family's MODEL rows can see.
|
|
32
|
+
*
|
|
33
|
+
* Both are family packages (`tool-skill-manage`, `tool-memory`), so a session
|
|
34
|
+
* that merely carries the platform's own session-query tool is not mistaken for
|
|
35
|
+
* a family session. Two names, not one: a deployment may disable either row.
|
|
36
|
+
*/
|
|
37
|
+
export declare const FAMILY_SESSION_TOOL_NAMES: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Does this session's scope see the family's model tools?
|
|
40
|
+
*
|
|
41
|
+
* The scope is the live agent's — the platform's own addressing for "what does
|
|
42
|
+
* this session see" (`tools.get(name, scope)`, packages/core/tools/src/index.ts:1194).
|
|
43
|
+
* A session with no live agent (a finished or cold session) has no scope to ask
|
|
44
|
+
* in, so it resolves to false; the consumers this gate serves only run for live
|
|
45
|
+
* agents.
|
|
46
|
+
* @param ctx - a context of the runtime (any plane; the services are read from the global store).
|
|
47
|
+
* @param sessionId - the session to ask about.
|
|
48
|
+
* @returns true when at least one family model tool is visible to that session.
|
|
49
|
+
*/
|
|
50
|
+
export declare function sessionSeesFamilyTools(ctx: Context, sessionId: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The one decision every cross-session consumer calls before it acts.
|
|
53
|
+
* @param ctx - a context of the runtime.
|
|
54
|
+
* @param sessionId - the session the event belongs to.
|
|
55
|
+
* @param sessionScoped - the row's `sessionScoped` config.
|
|
56
|
+
* @returns true when the consumer may act on this session. A deployment that did
|
|
57
|
+
* not declare session scoping always answers true (the historical behavior);
|
|
58
|
+
* a scoped one answers true only for a session that carries the family's model
|
|
59
|
+
* tools.
|
|
60
|
+
*/
|
|
61
|
+
export declare function sessionAudited(ctx: Context, sessionId: string, sessionScoped: boolean | undefined): boolean;
|
|
62
|
+
//# sourceMappingURL=opt-in.d.ts.map
|
package/package.json
CHANGED