mirror of
https://git.openapi.site/https://github.com/desirecore/agent-desirecore.git
synced 2026-12-05 13:09:37 +08:00
feat: 提供工作台应用开发发布技能与示例
This commit is contained in:
1 parent
6cbc736a69
commit
0204c31f54
27 files changed
+874
-5
No files matched your search
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 DesireCore
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"canonicalization": "app-release-c14n-v1",
|
||||
"definition": {
|
||||
"id": "service-notes-workbench",
|
||||
"name": "服务笔记工作台",
|
||||
"version": "1.0.0",
|
||||
"productKind": "application",
|
||||
"icon": "PanelsTopLeft",
|
||||
"iconLetter": "台",
|
||||
"entrypoints": [
|
||||
{
|
||||
"id": "main",
|
||||
"name": "笔记",
|
||||
"kind": "embedded-web",
|
||||
"serviceRef": "workbench:main"
|
||||
}
|
||||
],
|
||||
"placementPolicy": {
|
||||
"showInMyApps": true,
|
||||
"allowNavPin": true,
|
||||
"allowAgentBinding": true
|
||||
}
|
||||
},
|
||||
"delivery": {
|
||||
"type": "native-app",
|
||||
"runtimeInstructionsPath": "runtime/运行说明.md"
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"path": "LICENSE",
|
||||
"role": "license",
|
||||
"sha256": "e863481f423546e8984c07ffa00609d338b7f7533f60e89392301028163aa89e",
|
||||
"size": 1067
|
||||
},
|
||||
{
|
||||
"path": "application.json",
|
||||
"role": "definition",
|
||||
"sha256": "34f3ef80d33f3182f461f93e646d3fdb13865fb07214b505b55a64514c1284e1",
|
||||
"size": 433
|
||||
},
|
||||
{
|
||||
"path": "data-contract.json",
|
||||
"role": "data-contract",
|
||||
"sha256": "e195b2fd60a2798141c4c75ab57e0927d115bfba7888b0881b69dffa9dcb26cc",
|
||||
"size": 266
|
||||
},
|
||||
{
|
||||
"path": "runtime/server.mjs",
|
||||
"role": "runtime",
|
||||
"sha256": "3ccea1e06f3371e98cc8277d2b82d70cdcca7dd43ff8c40ab43a3c14ba0ee456",
|
||||
"size": 2633
|
||||
},
|
||||
{
|
||||
"path": "runtime/运行说明.md",
|
||||
"role": "documentation",
|
||||
"sha256": "6225a3e5afdd835a1de54df1287afd8d3bef69a9ae1b44535aae2e7adf3376b6",
|
||||
"size": 1910
|
||||
},
|
||||
{
|
||||
"path": "ui/app.js",
|
||||
"role": "ui",
|
||||
"sha256": "3bc131e1afd3063e13373c6b64f86f9202a1bda78ce606e9137133c6e60abdae",
|
||||
"size": 5204
|
||||
},
|
||||
{
|
||||
"path": "ui/bridge.js",
|
||||
"role": "ui",
|
||||
"sha256": "0a436b5244acfd924b96274377c8758bf92ea665b0591afaddee064f48d0b599",
|
||||
"size": 2939
|
||||
},
|
||||
{
|
||||
"path": "ui/index.html",
|
||||
"role": "ui",
|
||||
"sha256": "2c028db0db06249768e4222c488554cb8db6e2b75fe5da21630bf59f547044b7",
|
||||
"size": 2282
|
||||
},
|
||||
{
|
||||
"path": "说明.md",
|
||||
"role": "documentation",
|
||||
"sha256": "7b9f6cbb89fbaa51c3ff717f75fd76eaf80afd2ea82a67e40561e9b845cf51a7",
|
||||
"size": 1032
|
||||
}
|
||||
],
|
||||
"source": {
|
||||
"kind": "worktree",
|
||||
"sha256": "5f6448e5f8e45f6720a1d9ee7fc677c2a48cee7e148a1785a293940be427a32f"
|
||||
},
|
||||
"supportedPlatforms": [
|
||||
"darwin",
|
||||
"win32",
|
||||
"linux"
|
||||
],
|
||||
"minimumClientVersion": "10.0.180",
|
||||
"requiredCapabilities": [
|
||||
"app-authoring-v1",
|
||||
"release",
|
||||
"runtime-binding",
|
||||
"bridge",
|
||||
"data"
|
||||
],
|
||||
"dataContract": {
|
||||
"schemaVersion": 1,
|
||||
"formatVersion": "notes-v1",
|
||||
"readableVersions": [
|
||||
"notes-v1"
|
||||
],
|
||||
"writableVersions": [
|
||||
"notes-v1"
|
||||
],
|
||||
"files": [
|
||||
{
|
||||
"key": "notes",
|
||||
"path": "notes.json",
|
||||
"maxBytes": 131072,
|
||||
"contentType": "application/json"
|
||||
}
|
||||
],
|
||||
"uninstallRetention": "retain"
|
||||
},
|
||||
"bridgeCapabilities": [
|
||||
"connect",
|
||||
"capabilities",
|
||||
"readData",
|
||||
"saveData",
|
||||
"lookupDataMutation",
|
||||
"publishSelection",
|
||||
"requestWork",
|
||||
"lookupRequest",
|
||||
"readWork"
|
||||
],
|
||||
"instructionsPath": "说明.md",
|
||||
"releaseDigest": "9db7813e5c44bb64e2fd53bc4f02f556a8e68e01fa0205e0ce301f7d25661bf8"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"id": "service-notes-workbench",
|
||||
"name": "服务笔记工作台",
|
||||
"version": "1.0.0",
|
||||
"productKind": "application",
|
||||
"icon": "PanelsTopLeft",
|
||||
"iconLetter": "台",
|
||||
"entrypoints": [
|
||||
{
|
||||
"id": "main",
|
||||
"name": "笔记",
|
||||
"kind": "embedded-web",
|
||||
"serviceRef": "workbench:main"
|
||||
}
|
||||
],
|
||||
"placementPolicy": {
|
||||
"showInMyApps": true,
|
||||
"allowNavPin": true,
|
||||
"allowAgentBinding": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"schemaVersion": 1, "formatVersion": "notes-v1", "readableVersions": ["notes-v1"], "writableVersions": ["notes-v1"],
|
||||
"files": [{ "key": "notes", "path": "notes.json", "maxBytes": 131072, "contentType": "application/json" }],
|
||||
"uninstallRetention": "retain"
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"description": "显式收录网页与只读分析服务;笔记使用平台有限data key,不写固定程序目录。",
|
||||
"delivery": {
|
||||
"type": "native-app",
|
||||
"runtimeInstructionsPath": "runtime/运行说明.md"
|
||||
},
|
||||
"supportedPlatforms": [
|
||||
"darwin",
|
||||
"win32",
|
||||
"linux"
|
||||
],
|
||||
"requiredCapabilities": [
|
||||
"app-authoring-v1",
|
||||
"release",
|
||||
"runtime-binding",
|
||||
"bridge",
|
||||
"data"
|
||||
],
|
||||
"bridgeCapabilities": [
|
||||
"connect",
|
||||
"capabilities",
|
||||
"readData",
|
||||
"saveData",
|
||||
"lookupDataMutation",
|
||||
"publishSelection",
|
||||
"requestWork",
|
||||
"lookupRequest",
|
||||
"readWork"
|
||||
],
|
||||
"dataContractPath": "data-contract.json",
|
||||
"files": [
|
||||
{
|
||||
"path": "application.json",
|
||||
"role": "definition"
|
||||
},
|
||||
{
|
||||
"path": "ui/index.html",
|
||||
"role": "ui"
|
||||
},
|
||||
{
|
||||
"path": "ui/bridge.js",
|
||||
"role": "ui"
|
||||
},
|
||||
{
|
||||
"path": "ui/app.js",
|
||||
"role": "ui"
|
||||
},
|
||||
{
|
||||
"path": "data-contract.json",
|
||||
"role": "data-contract"
|
||||
},
|
||||
{
|
||||
"path": "说明.md",
|
||||
"role": "documentation"
|
||||
},
|
||||
{
|
||||
"path": "LICENSE",
|
||||
"role": "license"
|
||||
},
|
||||
{
|
||||
"path": "runtime/server.mjs",
|
||||
"role": "runtime"
|
||||
},
|
||||
{
|
||||
"path": "runtime/运行说明.md",
|
||||
"role": "documentation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/** 只读应用服务;业务数据在平台实例data key中,绝不写固定release目录。 */
|
||||
import http from 'node:http'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const port = Number(process.env.PORT)
|
||||
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error('PORT_required')
|
||||
const files = new Map([
|
||||
['/', ['../ui/index.html','text/html; charset=utf-8']],
|
||||
['/app.js',['../ui/app.js','text/javascript; charset=utf-8']],
|
||||
['/bridge.js',['../ui/bridge.js','text/javascript; charset=utf-8']],
|
||||
])
|
||||
const server = http.createServer(async (request,response) => {
|
||||
const url = new URL(request.url ?? '/',`http://127.0.0.1:${port}`)
|
||||
response.setHeader('X-Content-Type-Options','nosniff')
|
||||
response.setHeader('Referrer-Policy','origin')
|
||||
if (request.method !== 'GET') { response.writeHead(405); return response.end() }
|
||||
if (url.pathname === '/.desirecore-app-identity') {
|
||||
response.setHeader('Content-Type','application/json')
|
||||
response.setHeader('Cache-Control','no-store')
|
||||
const identity = {proof:process.env.DESIRECORE_APP_RUNTIME_PROOF,releaseDigest:process.env.DESIRECORE_APP_RELEASE_DIGEST,
|
||||
scopeId:process.env.DESIRECORE_APP_SCOPE_ID,runtimeGeneration:process.env.DESIRECORE_APP_RUNTIME_GENERATION}
|
||||
if (Object.values(identity).some(value => typeof value !== 'string' || !value)) { response.writeHead(503); return response.end(JSON.stringify({error:'managed_runtime_identity_unavailable'})) }
|
||||
return response.end(JSON.stringify(identity))
|
||||
}
|
||||
if (url.pathname === '/api/summary') {
|
||||
const count = Number(url.searchParams.get('count'))
|
||||
if (!Number.isInteger(count) || count < 0 || count > 10000) { response.writeHead(400); return response.end() }
|
||||
response.setHeader('Content-Type','application/json')
|
||||
return response.end(JSON.stringify({count,summary:`当前工作台有 ${count} 条笔记。`,dataAccess:'none'}))
|
||||
}
|
||||
const entry = files.get(url.pathname)
|
||||
if (!entry) { response.writeHead(404); return response.end() }
|
||||
response.setHeader('Content-Type',entry[1])
|
||||
response.setHeader('Content-Security-Policy',"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none'; base-uri 'none'")
|
||||
try { response.end(readFileSync(fileURLToPath(new URL(entry[0],import.meta.url)))) }
|
||||
catch { response.writeHead(503); response.end('material_unavailable') }
|
||||
})
|
||||
server.listen(port,'127.0.0.1',() => console.log(`Application service listening on loopback port ${port}`))
|
||||
for (const signal of ['SIGINT','SIGTERM']) process.on(signal,() => server.close(() => process.exit(0)))
|
||||
@@ -0,0 +1,11 @@
|
||||
# 运行服务笔记工作台
|
||||
|
||||
需要用户实际选择并可用的 Node.js 运行时。此示例不安装 Node、Docker 或第三方数据库,不向平台注册 MCP。Node 服务只提供固定网页、只读计数分析和当前 TaskHost 运行身份握手;业务笔记使用平台有限 data key,与静态示例采用同一CAS保存约定。
|
||||
|
||||
在获授权的材料目录生成release并prepare后,使用原执行工具实际启动 `PORT=<已选择空闲端口> node runtime/server.mjs`。端口需固定在原接受的执行合同,不能靠网页声明任意endpoint。身份由原TaskHost在受控正式spawn时注入:DESIRECORE_APP_RUNTIME_PROOF、DESIRECORE_APP_RELEASE_DIGEST、DESIRECORE_APP_SCOPE_ID、DESIRECORE_APP_RUNTIME_GENERATION。应用不能自报固定PID或伪造proof,不能将proof用于其他API或日志。
|
||||
|
||||
调用 `/api/apps/runtime/contracts` 时给真实prepareRef、installationId、terminalId、endpoint.port与identityPath `/.desirecore-app-identity`,以及用户选择的 manual/on-open。纳管读取原accepted-command冻结执行合同;由原执行工具明确停掉此前命令,commit后由原owner启动正式新代际,再核读运行身份和应用功能。原先裸启动的服务在没有managed身份时会明确返回503,它只能帮助开发调试,不能证明正式可信直开。
|
||||
|
||||
公开执行环境不接受任意.env。若改造应用需要后端直接读写数据,须使用实际数据owner授予并注入的独立根;缺授权时不写盘,不默认使用cwd或release目录。此教学服务没有后端数据写入,因此不需要APP_DATA_DIR,不持有平台凭据。
|
||||
|
||||
停止、更新、失败恢复沿原TaskHost/Run,不重复开第二个后台进程。scope/release/generation改变后旧连接失效;重启须重新取得owner身份与审批事实。端口被占用不接管,不把HTTP200作为运行归属证明。
|
||||
@@ -0,0 +1,68 @@
|
||||
import { connectBridge } from './bridge.js'
|
||||
const element = id => document.getElementById(id)
|
||||
let bridge, connection, etag, notes = [], selected, pendingSave, pendingWork
|
||||
const status = message => { element('status').textContent = message }
|
||||
function render() {
|
||||
element('notes').replaceChildren()
|
||||
for (const note of notes) {
|
||||
const row = document.createElement('li'), text = document.createElement('div'), button = document.createElement('button')
|
||||
text.textContent = note.text; button.textContent = selected?.id === note.id ? '已选中' : '选择此笔记'
|
||||
button.addEventListener('click', () => { selected = note; render() }); row.append(text,button); element('notes').append(row)
|
||||
}
|
||||
}
|
||||
async function read() {
|
||||
const result = await bridge.call('readData',{key:'notes'})
|
||||
const value = result.exists ? JSON.parse(result.content) : {schemaVersion:1,notes:[]}
|
||||
if (value.schemaVersion !== 1 || !Array.isArray(value.notes)) throw new Error('notes_format_unsupported')
|
||||
notes = value.notes; etag = result.etag; selected = notes.find(note => note.id === selected?.id); render()
|
||||
status('已读取当前实例的数据。')
|
||||
}
|
||||
async function save() {
|
||||
if (!pendingSave) {
|
||||
const text = element('note').value.trim()
|
||||
if (!text) return status('先输入笔记。')
|
||||
pendingSave = {key:'notes',mutationId:crypto.randomUUID(),content:JSON.stringify({schemaVersion:1,notes:[...notes,{id:crypto.randomUUID(),revision:'1',text}]}),
|
||||
...(etag ? {expectedETag:etag} : {expectedAbsent:true})}
|
||||
}
|
||||
try {
|
||||
const receipt = await bridge.call('saveData',pendingSave)
|
||||
if (receipt.status !== 'saved') throw new Error('save_result_unknown')
|
||||
pendingSave = undefined; element('recover').disabled = true; element('note').value = ''; await read(); status('保存回执已核验。')
|
||||
} catch (error) { element('recover').disabled = false; status(`保存尚未确认:${error.message}。保留原ID和正文,先查询原保存;未确认前不要添加另一条笔记。`) }
|
||||
}
|
||||
element('save').addEventListener('click',save)
|
||||
element('refresh').addEventListener('click',() => pendingSave ? status('还有结果不明的原保存,请先查询。') : read().catch(error => status(error.message)))
|
||||
element('recover').addEventListener('click',async () => {
|
||||
if (!pendingSave) return
|
||||
try {
|
||||
const result = await bridge.call('lookupDataMutation',{key:'notes',mutationId:pendingSave.mutationId})
|
||||
if (result.status === 'saved') { pendingSave = undefined; element('recover').disabled = true; element('note').value = ''; await read() }
|
||||
else status(result.status === 'absent' ? '原保存明确未发生。可以用“保存笔记”重试同ID和原正文,冲突时读取并人工合并。' : '原保存仍不明确,请保留当前页面和原ID。')
|
||||
} catch (error) { status(error.message) }
|
||||
})
|
||||
element('request').addEventListener('click',async () => {
|
||||
const agentId = element('agent').value.trim()
|
||||
if (!agentId || !selected) return element('work-status').textContent = '先选择笔记和实际Agent。'
|
||||
if (pendingWork) return element('work-status').textContent = '已有待查询请求,请沿原ID恢复。'
|
||||
pendingWork = {clientRequestId:crypto.randomUUID(),userMessageId:crypto.randomUUID(),agentId,
|
||||
prompt:`请讨论这条笔记并给出可执行建议:${selected.text}`,scopeDescription:'读取notes来源文件核验所选笔记,只讨论该记录,不修改其他记录。',
|
||||
selection:{schemaVersion:1,selectionRevision:crypto.randomUUID(),summary:`笔记ID:${selected.id},记录版本:${selected.revision},内容:${selected.text};正式实例对象引用授予读取notes来源文件。`,objects:connection.application && etag ?
|
||||
[{schemaVersion:1,...connection.application,namespace:'data-files',objectId:'notes',revision:etag}] : []}}
|
||||
element('work').disabled = false
|
||||
try {
|
||||
const proposal = await bridge.call('prepareWork',pendingWork)
|
||||
element('work-status').textContent = `提案已准备,等待平台控件接纳。提案引用:${proposal.proposalRef}`
|
||||
} catch (error) { element('work-status').textContent = `提案/请求结果尚未确认:${error.message};保留原请求ID查询。` }
|
||||
})
|
||||
element('work').addEventListener('click',async () => {
|
||||
if (!pendingWork) return
|
||||
try { element('work-status').textContent = JSON.stringify(await bridge.call('lookupRequest',{clientRequestId:pendingWork.clientRequestId}),null,2) }
|
||||
catch (error) { element('work-status').textContent = error.message }
|
||||
})
|
||||
try {
|
||||
bridge = await connectBridge(); connection = await bridge.call('connect')
|
||||
bridge.onEvent(event => { if (event?.type === 'work-accepted' && event.clientRequestId === pendingWork?.clientRequestId)
|
||||
element('work-status').textContent = `平台接纳回执:${JSON.stringify(event.result)}。通过原请求继续查询,接纳不等于业务完成。` })
|
||||
await read(); element('save').disabled = !connection.capabilities?.includes('saveData'); element('refresh').disabled = false
|
||||
element('request').disabled = !connection.capabilities?.includes('requestWork')
|
||||
} catch (error) { status(`当前持久数据或协作能力不可用:${error.message}。未保存任何业务数据。`) }
|
||||
@@ -0,0 +1,46 @@
|
||||
/** 教学SDK适配:桌面有限preload;Web严格parent来源/nonce握手,没有管理token或任意invoke。 */
|
||||
const methods = new Set(['connect','capabilities','publishSelection','prepareWork','lookupRequest','readWork','readData','saveData','lookupDataMutation'])
|
||||
export async function connectBridge() {
|
||||
if (window.desirecoreApp?.call) return window.desirecoreApp
|
||||
if (window.parent === window) throw new Error('app_bridge_host_unavailable')
|
||||
let origin
|
||||
try { origin = new URL(document.referrer).origin } catch { throw new Error('app_bridge_host_origin_required') }
|
||||
if (origin === 'null' || origin === location.origin) throw new Error('app_bridge_independent_origin_required')
|
||||
return new Promise((resolve, reject) => {
|
||||
let nonce
|
||||
const timer = setTimeout(() => { window.removeEventListener('message', receive); reject(new Error('app_bridge_host_unavailable')) }, 15000)
|
||||
function receive(event) {
|
||||
if (event.source !== window.parent || event.origin !== origin || !event.data || typeof event.data !== 'object') return
|
||||
if (event.data.protocol === 'desirecore-app-hello-v1' && typeof event.data.nonce === 'string' && !nonce) {
|
||||
nonce = event.data.nonce
|
||||
window.parent.postMessage({ protocol:'desirecore-app-ready-v1',nonce },origin)
|
||||
} else if (nonce && event.data.protocol === 'desirecore-app-port-v1' && event.data.nonce === nonce && event.ports.length === 1) {
|
||||
window.removeEventListener('message',receive); clearTimeout(timer); resolve(portClient(event.ports[0]))
|
||||
}
|
||||
}
|
||||
window.addEventListener('message',receive)
|
||||
})
|
||||
}
|
||||
function portClient(port) {
|
||||
const pending = new Map(), listeners = new Set()
|
||||
port.onmessage = event => {
|
||||
const message = event.data
|
||||
if (message?.protocol !== 'desirecore-app-bridge-v1') return
|
||||
const request = pending.get(message.requestId)
|
||||
if (request) { pending.delete(message.requestId); clearTimeout(request.timer); message.error ? request.reject(new Error(message.error)) : request.resolve(message.result) }
|
||||
else if (message.event !== undefined) for (const listener of listeners) listener(message.event)
|
||||
}
|
||||
port.start()
|
||||
return {
|
||||
call(method,payload) {
|
||||
if (!methods.has(method)) return Promise.reject(new Error('app_bridge_method_rejected'))
|
||||
const requestId = crypto.randomUUID()
|
||||
return new Promise((resolve,reject) => {
|
||||
const timer = setTimeout(() => { pending.delete(requestId); reject(new Error('app_bridge_result_unknown')) },30000)
|
||||
pending.set(requestId,{resolve,reject,timer}); port.postMessage({ protocol:'desirecore-app-bridge-v1',requestId,method,payload })
|
||||
})
|
||||
},
|
||||
onEvent(callback) { listeners.add(callback); return () => listeners.delete(callback) },
|
||||
close() { for (const request of pending.values()) { clearTimeout(request.timer); request.reject(new Error('app_bridge_closed')) }; pending.clear(); listeners.clear(); port.close() },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>服务笔记工作台</title>
|
||||
<style>
|
||||
:root{font:16px/1.6 system-ui,sans-serif;color:#253447;background:#f1f5f9}body{max-width:920px;margin:40px auto;padding:0 24px}h1{font-size:30px;line-height:1.2}p{color:#526174}section{padding:24px;background:#fff;border:1px solid #dbe3ed;border-radius:16px;margin:20px 0}textarea{box-sizing:border-box;width:100%;min-height:140px;padding:14px;font:inherit;border:1px solid #becbdc;border-radius:8px}button,input{font:inherit;padding:9px 14px;border:1px solid #becbdc;border-radius:8px}button{background:#fff;cursor:pointer;margin:10px 6px 0 0}button.primary{background:#274c77;color:#fff;border-color:#274c77}button:disabled{opacity:.5;cursor:default}ul{padding:0;list-style:none}li{border-top:1px solid #e7edf4;padding:12px 0;white-space:pre-wrap}li button{margin-top:6px}output{display:block;margin-top:12px;color:#526174;white-space:pre-wrap;overflow-wrap:anywhere}label{display:block;margin-top:16px}input{max-width:100%;box-sizing:border-box;width:400px}@media(max-width:580px){body{margin:20px auto;padding:0 12px}section{padding:16px}}
|
||||
</style>
|
||||
<h1>服务笔记工作台</h1><p>先把想法记下来,再把选中的内容交给 Agent。业务数据与应用程序版本分别保存。</p>
|
||||
<section><label for="note">新笔记</label><textarea id="note" placeholder="输入一条笔记"></textarea>
|
||||
<button id="save" class="primary" disabled>保存笔记</button><button id="refresh" disabled>读取最新版本</button><button id="recover" disabled>查询原保存</button>
|
||||
<output id="status" aria-live="polite">正在连接应用宿主…</output><ul id="notes"></ul></section>
|
||||
<section><h2>与 Agent 协作</h2><p>教学示例使用实际 Agent ID;应用可以自行设计选择器。工作须由平台控件接纳。</p>
|
||||
<label for="agent">本次 Agent ID</label><input id="agent" placeholder="由当前授权的 Agent 配置提供">
|
||||
<button id="request" disabled>交给 Agent 讨论选中笔记</button><button id="work" disabled>查询原请求</button><output id="work-status" aria-live="polite">尚未准备请求。</output></section>
|
||||
<script type="module" src="./app.js"></script></html>
|
||||
@@ -0,0 +1,7 @@
|
||||
# 服务笔记工作台教学示例
|
||||
|
||||
这是可修改的固定网页+原生Node只读服务,不是正式市场条目。先读本Skill作者接口和runtime/运行说明.md,在真实目标环境prepare、纳管原执行合同、正式发布并核验。缺TaskHost owner或真实身份时保持不可用,不能重标为静态网页来绕过。
|
||||
|
||||
笔记仍通过应用桥的notes key持久化,用户、实例和预览各有独立scope;Node端不写个人数据或固定程序目录。网页可在本源 `/api/summary?count=<当前笔记条数>` 请求只读统计;这个能力不使用平台token,也不接收任意文件路径或SQL。
|
||||
|
||||
与Agent协作、保存超时恢复及更新/data合同遵循静态示例的相同约定。应用是否能运行与外部Node环境、原执行owner和当前用户授权有关。包不附带用户数据库、.env、平台身份或proof值。分发必须取得真实不可变来源和目录审阅回执;第二用户安装需独立环境,不共享开发者进程或业务数据。
|
||||
Reference in new issue
Block a user