This commit is contained in:
@@ -144,7 +144,7 @@ export function ToolsExternalForm({ config, onChange }: SectionFormProps) {
|
||||
checked={tools.userScriptsEnabled === true}
|
||||
onChange={e => onChange('tools.userScriptsEnabled', e.target.checked)}
|
||||
/>
|
||||
<span>有効 (LLM の RunUserScript + scheduled script task が動作)</span>
|
||||
<span>有効 (browser-macros: LLM の RunUserScript + scheduled script task が動作)</span>
|
||||
</label>
|
||||
<HelpText>
|
||||
plain runtime は Node <code>--permission</code> で sandbox 化され child_process / worker / tmpdir 外の FS アクセスを deny。
|
||||
@@ -160,7 +160,7 @@ export function ToolsExternalForm({ config, onChange }: SectionFormProps) {
|
||||
placeholder="user id (例: 12345)"
|
||||
/>
|
||||
<HelpText>
|
||||
未指定なら <code>user_scripts_enabled</code> のみで制御。設定すると指定 ID のみ RunUserScript / scheduled script task が許可される。
|
||||
未指定なら <code>user_scripts_enabled</code> のみで制御。設定すると指定 ID のみ browser-macro の実行 (RunUserScript / scheduled script task) が許可される。
|
||||
</HelpText>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -270,7 +270,7 @@ export function ToolsForm({ config, onChange, visibleTabs }: ToolsFormProps) {
|
||||
checked={tools.userScriptsEnabled === true}
|
||||
onChange={e => onChange('tools.userScriptsEnabled', e.target.checked)}
|
||||
/>
|
||||
<span>有効 (LLM の RunUserScript + scheduled script task が動作)</span>
|
||||
<span>有効 (browser-macros: LLM の RunUserScript + scheduled script task が動作)</span>
|
||||
</label>
|
||||
<HelpText>
|
||||
plain runtime は Node <code>--permission</code> で sandbox 化され child_process / worker / tmpdir 外の FS アクセスを deny。
|
||||
@@ -286,7 +286,7 @@ export function ToolsForm({ config, onChange, visibleTabs }: ToolsFormProps) {
|
||||
placeholder="user id (例: 12345)"
|
||||
/>
|
||||
<HelpText>
|
||||
未指定なら <code>user_scripts_enabled</code> のみで制御。設定すると指定 ID のみ RunUserScript / scheduled script task が許可される。
|
||||
未指定なら <code>user_scripts_enabled</code> のみで制御。設定すると指定 ID のみ browser-macro の実行 (RunUserScript / scheduled script task) が許可される。
|
||||
</HelpText>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
// 'agents-md', 'browser-sessions', 'mcp', 'skills', 'pets', 'ssh-connections' are virtual subdirs (not raw file editor directories)
|
||||
export type SubdirId = 'agents-md' | 'scripts' | 'browser-macros' | 'templates' | 'recordings' | 'trash' | 'memory' | 'browser-sessions' | 'mcp' | 'skills' | 'pets' | 'ssh-connections' | 'notes' | 'subscribed-notes';
|
||||
// ('scripts' / 'templates' were retired 2026-06 — superseded by Skills + the Bash tool)
|
||||
export type SubdirId = 'agents-md' | 'browser-macros' | 'recordings' | 'trash' | 'memory' | 'browser-sessions' | 'mcp' | 'skills' | 'pets' | 'ssh-connections' | 'notes' | 'subscribed-notes';
|
||||
|
||||
/** True for subdirs that have actual files on disk */
|
||||
export const FILE_SUBDIRS: SubdirId[] = ['scripts', 'browser-macros', 'templates', 'recordings', 'trash', 'memory', 'notes'];
|
||||
export const FILE_SUBDIRS: SubdirId[] = ['browser-macros', 'recordings', 'trash', 'memory', 'notes'];
|
||||
|
||||
export interface FileEntry {
|
||||
name: string;
|
||||
@@ -29,9 +30,7 @@ interface FileTreeProps {
|
||||
|
||||
const SUBDIR_LABELS: Record<SubdirId, string> = {
|
||||
'agents-md': 'AGENTS.md',
|
||||
scripts: 'scripts',
|
||||
'browser-macros': 'browser-macros',
|
||||
templates: 'templates',
|
||||
recordings: 'recordings',
|
||||
trash: 'trash',
|
||||
memory: 'memory',
|
||||
@@ -46,9 +45,7 @@ const SUBDIR_LABELS: Record<SubdirId, string> = {
|
||||
|
||||
const SUBDIR_ICONS: Record<SubdirId, string> = {
|
||||
'agents-md': '📖',
|
||||
scripts: '📜',
|
||||
'browser-macros': '🤖',
|
||||
templates: '📄',
|
||||
recordings: '🎬',
|
||||
trash: '🗑',
|
||||
memory: '🧠',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
type WritableSubdir = 'scripts' | 'browser-macros' | 'templates';
|
||||
type WritableSubdir = 'browser-macros';
|
||||
|
||||
interface NewFileFormProps {
|
||||
subdir: WritableSubdir;
|
||||
@@ -11,23 +11,6 @@ interface NewFileFormProps {
|
||||
const TODAY = new Date().toISOString().slice(0, 10);
|
||||
|
||||
const SKELETON: Record<WritableSubdir, { ext: string; body: string }> = {
|
||||
scripts: {
|
||||
ext: '.js',
|
||||
body: `---
|
||||
description: <short summary>
|
||||
params:
|
||||
# name: { type: string, required: true, description: "..." }
|
||||
---
|
||||
|
||||
/**
|
||||
* Generated ${TODAY} via User Folder UI.
|
||||
*/
|
||||
export async function main({ params }) {
|
||||
console.log('script start', params);
|
||||
return { ok: true };
|
||||
}
|
||||
`,
|
||||
},
|
||||
'browser-macros': {
|
||||
ext: '.js',
|
||||
body: `---
|
||||
@@ -45,27 +28,12 @@ export async function main({ context, params }) {
|
||||
// await page.goto(params.url);
|
||||
return { ok: true };
|
||||
}
|
||||
`,
|
||||
},
|
||||
templates: {
|
||||
ext: '.md',
|
||||
body: `---
|
||||
description: <short summary>
|
||||
params:
|
||||
# title: { type: string, required: true }
|
||||
---
|
||||
|
||||
# {{title}}
|
||||
|
||||
Content here.
|
||||
`,
|
||||
},
|
||||
};
|
||||
|
||||
const SUBDIR_LABEL: Record<WritableSubdir, string> = {
|
||||
scripts: 'スクリプト',
|
||||
'browser-macros': 'ブラウザマクロ',
|
||||
templates: 'テンプレート',
|
||||
};
|
||||
|
||||
export function NewFileForm({ subdir, existingFilenames, onCreate }: NewFileFormProps) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { NotesPanel } from './NotesPanel';
|
||||
import { SubscriptionsPanel } from './SubscriptionsPanel';
|
||||
import { SkillsPanel } from './SkillsPanel';
|
||||
/** All subdirs shown in the tree — both real file-based and virtual. */
|
||||
const ALL_SUBDIRS: SubdirId[] = ['agents-md', 'scripts', 'browser-macros', 'templates', 'recordings', 'notes', 'subscribed-notes', 'pets', 'browser-sessions', 'mcp', 'skills', 'ssh-connections', 'trash', 'memory'];
|
||||
const ALL_SUBDIRS: SubdirId[] = ['agents-md', 'browser-macros', 'recordings', 'notes', 'subscribed-notes', 'pets', 'browser-sessions', 'mcp', 'skills', 'ssh-connections', 'trash', 'memory'];
|
||||
|
||||
const SUBDIR_INFO: { id: SubdirId; icon: string; title: string; desc: string; agency: string }[] = [
|
||||
{
|
||||
@@ -24,27 +24,13 @@ const SUBDIR_INFO: { id: SubdirId; icon: string; title: string; desc: string; ag
|
||||
desc: 'タスク起動時に system prompt へ自動注入される、ユーザー専用の永続的な指示。 「常に丁寧な日本語で答える」「Tailwind を優先」等、毎タスクで覚えて欲しい好み・ルールを書く。 最大 64KB。 ファイル形式は markdown。',
|
||||
agency: 'ユーザー編集 / エージェントが自動参照',
|
||||
},
|
||||
{
|
||||
id: 'scripts',
|
||||
icon: '📜',
|
||||
title: 'scripts/',
|
||||
desc: 'AI 生成の汎用 Node スクリプト。エージェントが RunUserScript ツールで実行 (kind: "script")。Chromium 起動なし、main({ params }) シグネチャ。データ整形・API 呼び出し・計算・ファイル変換等の繰り返し処理に向く。',
|
||||
agency: 'エージェント/ユーザー両方 / 軽量・高速',
|
||||
},
|
||||
{
|
||||
id: 'browser-macros',
|
||||
icon: '🤖',
|
||||
title: 'browser-macros/',
|
||||
desc: 'Playwright ベースのブラウザマクロ。recordings/ から "Save as Script" で生成、または UI で手書き。RunUserScript ツール (kind: "browser-macro") で実行。main({ context, params }) シグネチャで context は Playwright BrowserContext。session_profile_id で保存済みログインを利用可能。.next.js は self-healing 失敗時の自動パッチ候補で、Diff レビュー後に accept/reject。',
|
||||
desc: 'Playwright ベースのブラウザマクロ。recordings/ から "Save as Script" で生成、または UI で手書き。RunUserScript ツールで実行。main({ context, params }) シグネチャで context は Playwright BrowserContext。session_profile_id で保存済みログインを利用可能。.next.js は self-healing 失敗時の自動パッチ候補で、Diff レビュー後に accept/reject。雛形・手順書は Skills へ、アドホックなコード実行は Bash ツールへ。',
|
||||
agency: 'エージェント実行 / UI で recordings → スクリプト化',
|
||||
},
|
||||
{
|
||||
id: 'templates',
|
||||
icon: '📄',
|
||||
title: 'templates/',
|
||||
desc: '定型文・雛形の置き場。UI で作成・編集する。エージェントが ReadUserTemplate で本文を読むか、RenderUserTemplate で frontmatter.params の {{var}} を埋めた結果を取得できる。報告書の雛形・メール文面・コードボイラープレート等を貯めておくと、繰り返しタスクで「雛形を埋めて」と指示しやすい。',
|
||||
agency: 'ユーザー作成 / エージェントが ReadUserTemplate / RenderUserTemplate で利用',
|
||||
},
|
||||
{
|
||||
id: 'recordings',
|
||||
icon: '🎬',
|
||||
@@ -186,7 +172,7 @@ async function apiFolderDelete(subdir: SubdirId, path: string): Promise<void> {
|
||||
const VIRTUAL_SUBDIRS = new Set<SubdirId>(['agents-md', 'browser-sessions', 'mcp', 'skills', 'pets', 'ssh-connections', 'subscribed-notes']);
|
||||
|
||||
/** Subdirs where users can create new files from the UI */
|
||||
const WRITABLE_USER_SUBDIRS = new Set<SubdirId>(['scripts', 'browser-macros', 'templates']);
|
||||
const WRITABLE_USER_SUBDIRS = new Set<SubdirId>(['browser-macros']);
|
||||
|
||||
type ShowToast = (message: string, variant?: 'success' | 'error') => void;
|
||||
|
||||
@@ -195,7 +181,7 @@ interface UserFolderTabProps {
|
||||
}
|
||||
|
||||
export function UserFolderTab({ showToast }: UserFolderTabProps = {}) {
|
||||
const [selectedSubdir, setSelectedSubdir] = useState<SubdirId | null>('scripts');
|
||||
const [selectedSubdir, setSelectedSubdir] = useState<SubdirId | null>('browser-macros');
|
||||
const [selectedFile, setSelectedFile] = useState<string | null>(null);
|
||||
const [editorDirty, setEditorDirty] = useState(false);
|
||||
const [saveAsDialogOpen, setSaveAsDialogOpen] = useState(false);
|
||||
@@ -475,7 +461,7 @@ export function UserFolderTab({ showToast }: UserFolderTabProps = {}) {
|
||||
</div>
|
||||
)}
|
||||
<NewFileForm
|
||||
subdir={selectedSubdir as 'scripts' | 'browser-macros' | 'templates'}
|
||||
subdir={selectedSubdir as 'browser-macros'}
|
||||
existingFilenames={files.map(f => f.name)}
|
||||
onCreate={async (filename, skeleton) => {
|
||||
await apiFolderPut(selectedSubdir, filename, skeleton);
|
||||
|
||||
Reference in New Issue
Block a user