On this page
Overview
Owns conversation limits, control messages, submission barriers, elapsed formatting, and delivery proof.
- Artifact
ConversationTimebox.js· esm - Classification
public first party - Availability
Cross-host - Normalization
State/command/delivery errors plus exact required user-facing message are normalized.
Import and lifecycle
import * as module from '/arcane/modules/ConversationTimebox.js';
ConversationTimebox starts and cancels a periodic tick, holds in-memory deadline state, and notifies subscribed callbacks; dispose cancels the timer and clears listeners.
Application-facing behavior: Event/error/reason constants; default ConversationTimebox, ConversationSubmissionBarrier, control constants/helpers, required message tool schema, state-free on/addEventListener compatibility, and dispose().
Protocol and host implementation
Clock/timers, callbacks, and per-realm globalThis.arcaneEvents authority This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
CONVERSATION_TIMEBOX_EVENT_TYPES | variable · value | variable CONVERSATION_TIMEBOX_EVENT_TYPES | — |
CONVERSATION_TIMEBOX_ERROR_CODES | variable · value | variable CONVERSATION_TIMEBOX_ERROR_CODES | — |
CONVERSATION_TIMEBOX_REASONS | variable · value | variable CONVERSATION_TIMEBOX_REASONS | — |
appendConversationTimeboxOpeningInstruction | function | function appendConversationTimeboxOpeningInstruction(message='') | message='' |
CONVERSATION_TIMEBOX_LIMIT_MESSAGE | variable · value | variable CONVERSATION_TIMEBOX_LIMIT_MESSAGE | — |
CONVERSATION_TIMEBOX_OPENING_INSTRUCTION | variable · value | variable CONVERSATION_TIMEBOX_OPENING_INSTRUCTION | — |
CONVERSATION_TIMEBOX_TOOL_NAME | variable · value | variable CONVERSATION_TIMEBOX_TOOL_NAME | — |
ConversationSubmissionBarrier | class | class ConversationSubmissionBarrier | — |
consumeConversationTimeboxCall | function | function consumeConversationTimeboxCall(calls,controller) | calls,controller |
conversationTimeboxTool | variable · value | variable conversationTimeboxTool | — |
conversationTimeboxSubmissionKey | function | function conversationTimeboxSubmissionKey(context={}) | context={} |
createConversationTimeboxControlMessage | function | function createConversationTimeboxControlMessage(action,milliseconds) | action,milliseconds |
formatConversationElapsed | function | function formatConversationElapsed(milliseconds=0) | milliseconds=0 |
normalizeConversationTimeboxCommand | function | function normalizeConversationTimeboxCommand(value) | value |
requireConversationTimeboxDelivery | function | function requireConversationTimeboxDelivery(result) | result |
default | default · class | class ConversationTimebox | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
ConversationTimebox.constructor | constructor | constructor(options={}) | options={} |
ConversationSubmissionBarrier.pendingCount | get | get pendingCount() | — |
ConversationSubmissionBarrier.track | method | track(result) | result |
ConversationSubmissionBarrier.waitForIdle | async method | async waitForIdle() | — |
ConversationTimebox.limitReachedMessage | get | get limitReachedMessage() | — |
ConversationTimebox.controlMessage | method | controlMessage(action,milliseconds) | action,milliseconds |
ConversationTimebox.start | method | start() | — |
ConversationTimebox.setLimitMilliseconds | method | setLimitMilliseconds(milliseconds,{source='user'}={}) | milliseconds,{source='user'}={} |
ConversationTimebox.adjustLimitMilliseconds | method | adjustLimitMilliseconds(milliseconds,{source='user'}={}) | milliseconds,{source='user'}={} |
ConversationTimebox.clearLimit | method | clearLimit({source='user'}={}) | {source='user'}={} |
ConversationTimebox.applyCommand | method | applyCommand(value) | value |
ConversationTimebox.subscribe | method | subscribe(listener,options={}) | listener,options={} |
ConversationTimebox.snapshot | method | snapshot() | — |
ConversationTimebox.dispose | method | dispose() | — |
Parameter meanings and results
The class starts, sets, adjusts, clears, applies, snapshots, subscribes, and disposes limits. conversationTimeboxTool requires action and a nonempty string message in every function argument object; set and adjust also require duration_milliseconds. normalizeConversationTimeboxCommand preserves message, and applyCommand plus a fulfilled consumeConversationTimeboxCall result return the changed state with that user-facing message. Exported helpers also cover sole-tool commands, control messages, elapsed display, submission keys, barriers, and delivery proof.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- subscriber snapshot
- subscriber change
- subscriber tick
- subscriber due
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- TypeError or RangeError for invalid options, clock, commands, durations, or dates
- CONVERSATION_TIMEBOX_MUST_BE_SOLE_CALL
- requireConversationTimeboxDelivery throws on false
Availability and capabilities
Cross-host. State/command/delivery errors plus exact required user-facing message are normalized.
Cross-host conversation control contract using clocks and callbacks; it supplies a provider tool schema but does not call Core.
Contract example
import ConversationTimebox from '/arcane/modules/ConversationTimebox.js';
let now=1000;
const box=new ConversationTimebox({
clock:()=>now,
schedule:()=>1,
cancel:()=>{},
tickMs:1000
});
box.start();
console.log(box.applyCommand({
action:'set',
duration_milliseconds:60_000,
message:'Setting the requested one-minute time check.'
}));
box.dispose();
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.