@miphamai/cli 0.19.0 → 0.19.3
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/package.json +1 -1
- package/src/core/session-store.ts +1 -0
- package/src/index.tsx +1 -5
- package/src/plugin/plugin-loader.ts +1 -2
- package/src/shared/types.ts +3 -18
- package/src/tools/exec/task.ts +1 -2
- package/src/tools/index.ts +1 -2
- package/src/ui/commands.ts +9 -3
- package/src/workflow/sandbox.ts +1 -2
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -120,14 +120,10 @@ export async function runApp(options: RunOptions): Promise<void> {
|
|
|
120
120
|
)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const useRealTokenizer = config.features?.context?.useRealTokenizer !== false
|
|
124
|
-
const adaptiveThresholds = config.features?.context?.adaptiveThresholds !== false
|
|
125
|
-
const effectiveContextWindow = adaptiveThresholds ? modelContextWindow : 200_000
|
|
126
|
-
|
|
127
123
|
const context = new ContextManager({
|
|
128
124
|
maxTokens: contextMaxTokens,
|
|
129
125
|
compactionThreshold: 0.9,
|
|
130
|
-
contextWindow:
|
|
126
|
+
contextWindow: modelContextWindow,
|
|
131
127
|
})
|
|
132
128
|
|
|
133
129
|
if (options.resume) {
|
|
@@ -99,8 +99,7 @@ export function loadPlugins(
|
|
|
99
99
|
for (const hookCfg of manifest.hooks as HookConfig[]) {
|
|
100
100
|
if (hookCfg.type && hookCfg) {
|
|
101
101
|
const event = (hookCfg as unknown as Record<string, unknown>).event as
|
|
102
|
-
|
|
|
103
|
-
| undefined
|
|
102
|
+
HookEvent | undefined
|
|
104
103
|
if (event) {
|
|
105
104
|
hookEvents.push(event)
|
|
106
105
|
hookEngine.register({
|
package/src/shared/types.ts
CHANGED
|
@@ -46,11 +46,7 @@ export interface ThinkingContent {
|
|
|
46
46
|
thinking: string
|
|
47
47
|
}
|
|
48
48
|
export type ContentBlock =
|
|
49
|
-
|
|
|
50
|
-
| ImageContent
|
|
51
|
-
| ToolUseContent
|
|
52
|
-
| ToolResultContent
|
|
53
|
-
| ThinkingContent
|
|
49
|
+
TextContent | ImageContent | ToolUseContent | ToolResultContent | ThinkingContent
|
|
54
50
|
|
|
55
51
|
export interface Message {
|
|
56
52
|
role: 'system' | 'user' | 'assistant'
|
|
@@ -62,13 +58,7 @@ export interface Message {
|
|
|
62
58
|
// ── Tool Types ──
|
|
63
59
|
export type ToolPermission = 'auto' | 'ask' | 'bypass'
|
|
64
60
|
export type ToolCategory =
|
|
65
|
-
| '
|
|
66
|
-
| 'exec'
|
|
67
|
-
| 'agent'
|
|
68
|
-
| 'network'
|
|
69
|
-
| 'system'
|
|
70
|
-
| 'artifact'
|
|
71
|
-
| 'scheduling'
|
|
61
|
+
'file' | 'exec' | 'agent' | 'network' | 'system' | 'artifact' | 'scheduling'
|
|
72
62
|
|
|
73
63
|
export interface ToolContext {
|
|
74
64
|
cwd: string
|
|
@@ -293,12 +283,7 @@ export interface InstructionFile {
|
|
|
293
283
|
// ── Permission Types ──
|
|
294
284
|
/** Six explicit permission modes matching Claude Code's permission architecture */
|
|
295
285
|
export type PermissionMode =
|
|
296
|
-
| '
|
|
297
|
-
| 'acceptEdits'
|
|
298
|
-
| 'plan'
|
|
299
|
-
| 'auto'
|
|
300
|
-
| 'dontAsk'
|
|
301
|
-
| 'bypassPermissions'
|
|
286
|
+
'default' | 'acceptEdits' | 'plan' | 'auto' | 'dontAsk' | 'bypassPermissions'
|
|
302
287
|
|
|
303
288
|
/** Backward-compatible alias: PermissionMode plus legacy 'ask' and 'bypass' */
|
|
304
289
|
export type PermissionLevel = PermissionMode | 'ask' | 'bypass'
|
package/src/tools/exec/task.ts
CHANGED
|
@@ -362,8 +362,7 @@ export const taskTool: ToolDefinition = {
|
|
|
362
362
|
// Signal to any background registry that this task should stop
|
|
363
363
|
// The background registry will be injected via the engine context
|
|
364
364
|
const bgRegistry = (_ctx as unknown as Record<string, unknown>).backgroundAgentRegistry as
|
|
365
|
-
|
|
366
|
-
| undefined
|
|
365
|
+
{ stop(id: string): boolean } | undefined
|
|
367
366
|
if (bgRegistry) {
|
|
368
367
|
bgRegistry.stop(taskId)
|
|
369
368
|
}
|
package/src/tools/index.ts
CHANGED
|
@@ -51,8 +51,7 @@ function validateParams(
|
|
|
51
51
|
|
|
52
52
|
// Check types for provided fields
|
|
53
53
|
const properties = schema.properties as
|
|
54
|
-
|
|
55
|
-
| undefined
|
|
54
|
+
Record<string, { type: string; enum?: string[] }> | undefined
|
|
56
55
|
if (properties) {
|
|
57
56
|
for (const [key, def] of Object.entries(properties)) {
|
|
58
57
|
const value = params[key]
|
package/src/ui/commands.ts
CHANGED
|
@@ -1994,19 +1994,25 @@ const resumeLastCmd: CommandHandler = async () => {
|
|
|
1994
1994
|
}
|
|
1995
1995
|
}
|
|
1996
1996
|
|
|
1997
|
+
const MAX_RESUME = 30
|
|
1998
|
+
const truncated = session.messages.length > MAX_RESUME
|
|
1999
|
+
const messages = truncated ? session.messages.slice(-MAX_RESUME) : session.messages
|
|
2000
|
+
|
|
1997
2001
|
const date = new Date(latest.updatedAt).toLocaleString()
|
|
1998
2002
|
return {
|
|
1999
2003
|
content: [
|
|
2000
2004
|
'─ Session Restored ─',
|
|
2001
2005
|
'',
|
|
2002
2006
|
`Name: ${latest.name}`,
|
|
2003
|
-
`Messages: ${session.messages.length}`,
|
|
2007
|
+
`Messages: ${session.messages.length} total${truncated ? ` (showing last ${MAX_RESUME})` : ''}`,
|
|
2004
2008
|
`Provider: ${latest.provider} / ${latest.model}`,
|
|
2005
2009
|
`Updated: ${date}`,
|
|
2006
2010
|
'',
|
|
2007
|
-
|
|
2011
|
+
truncated
|
|
2012
|
+
? `${messages.length} of ${session.messages.length} messages loaded. Older context summarized above.`
|
|
2013
|
+
: `${messages.length} messages loaded. Context has been restored.`,
|
|
2008
2014
|
].join('\n'),
|
|
2009
|
-
forwardedMessages:
|
|
2015
|
+
forwardedMessages: messages,
|
|
2010
2016
|
}
|
|
2011
2017
|
}
|
|
2012
2018
|
|
package/src/workflow/sandbox.ts
CHANGED
|
@@ -66,8 +66,7 @@ export function createSandbox(
|
|
|
66
66
|
|
|
67
67
|
// Block crypto.randomUUID
|
|
68
68
|
const globalCrypto = (globalThis as Record<string, unknown>).crypto as
|
|
69
|
-
|
|
70
|
-
| undefined
|
|
69
|
+
{ randomUUID?: unknown; [key: string]: unknown } | undefined
|
|
71
70
|
if (globalCrypto) {
|
|
72
71
|
sandboxObj.crypto = new Proxy(globalCrypto, {
|
|
73
72
|
get(_target, prop) {
|