tinet-agent-cli 0.1.0.dev36__py3-none-any.whl
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.
- taco/__init__.py +1 -0
- taco/agent_openapi/__init__.py +1 -0
- taco/agent_openapi/catalog.py +198 -0
- taco/agent_openapi/models.py +47 -0
- taco/agent_openapi/parameters.py +111 -0
- taco/agent_openapi/service.py +73 -0
- taco/aikb/__init__.py +4 -0
- taco/aikb/catalog.py +380 -0
- taco/aikb/executors.py +157 -0
- taco/aikb/file_input.py +55 -0
- taco/aikb/models.py +42 -0
- taco/aikb/parameters.py +135 -0
- taco/aikb/service.py +68 -0
- taco/assets/__init__.py +1 -0
- taco/assets/agent_openapi/catalog.json +14 -0
- taco/assets/agent_openapi/operations/conversation/list-conversations.json +67 -0
- taco/assets/agent_openapi/operations/message/list-conversation-messages.json +80 -0
- taco/assets/agent_openapi/operations/trace/list-message-traces.json +72 -0
- taco/assets/aikb/catalog.json +41 -0
- taco/assets/aikb/operations/conversation/chat-conversation-on-open.json +99 -0
- taco/assets/aikb/operations/directory/delete-directory.json +81 -0
- taco/assets/aikb/operations/directory/edit-directory.json +97 -0
- taco/assets/aikb/operations/directory/list-directory-tree.json +106 -0
- taco/assets/aikb/operations/directory/save-directory.json +109 -0
- taco/assets/aikb/operations/faq/create-faq.json +193 -0
- taco/assets/aikb/operations/faq/delete-faq.json +81 -0
- taco/assets/aikb/operations/faq/describe-faq.json +82 -0
- taco/assets/aikb/operations/faq/edit-faq.json +193 -0
- taco/assets/aikb/operations/faq/list-faqs.json +136 -0
- taco/assets/aikb/operations/file/create-file.json +145 -0
- taco/assets/aikb/operations/file/delete-files.json +110 -0
- taco/assets/aikb/operations/file/describe-file.json +82 -0
- taco/assets/aikb/operations/file/get-file-upload-url.json +154 -0
- taco/assets/aikb/operations/file/list-files.json +146 -0
- taco/assets/aikb/operations/media/describe-faq-media-url.json +98 -0
- taco/assets/aikb/operations/media/describe-file-media-url.json +90 -0
- taco/assets/aikb/operations/oss/signature-for-upload.json +85 -0
- taco/assets/aikb/operations/recycle-bin/list-recycled-items.json +151 -0
- taco/assets/aikb/operations/repository/describe-bot-repository.json +71 -0
- taco/assets/aikb/operations/repository/list-private-repositories.json +75 -0
- taco/assets/aikb/operations/repository/list-public-repositories.json +75 -0
- taco/assets/aikb/operations/search/search-knowledge-on-open.json +180 -0
- taco/assets/examples/README.md +3 -0
- taco/assets/examples/agent-basic.json +16 -0
- taco/assets/examples/agent-builtin-tool.json +28 -0
- taco/assets/examples/agent-workflow-tool.json +30 -0
- taco/assets/examples/chatflow-basic.json +24 -0
- taco/assets/examples/workflow-http.json +34 -0
- taco/assets/manifest.json +12 -0
- taco/assets/scenarios/README.md +3 -0
- taco/assets/scenarios/agent-basic.json +80 -0
- taco/assets/scenarios/agent-builtin-tool.json +116 -0
- taco/assets/scenarios/agent-workflow-tool.json +277 -0
- taco/assets/schemas/README.md +3 -0
- taco/assets/schemas/agent-tool.json +71 -0
- taco/assets/schemas/agent.json +199 -0
- taco/assets/schemas/chatflow.json +1048 -0
- taco/assets/schemas/workflow.http.json +1052 -0
- taco/assets/schemas/workflow.json +1052 -0
- taco/assets/skills/README.md +3 -0
- taco/assets/skills/taco/SKILL.md +68 -0
- taco/assets/skills/taco/manifest.json +10 -0
- taco/cli.py +127 -0
- taco/commands/__init__.py +1 -0
- taco/commands/agent.py +760 -0
- taco/commands/aikb.py +132 -0
- taco/commands/app.py +151 -0
- taco/commands/category.py +37 -0
- taco/commands/chatflow.py +183 -0
- taco/commands/credential.py +222 -0
- taco/commands/discovery.py +409 -0
- taco/commands/model.py +55 -0
- taco/commands/profile.py +124 -0
- taco/commands/tool.py +61 -0
- taco/commands/workflow.py +714 -0
- taco/core/__init__.py +1 -0
- taco/core/access_token_manager.py +98 -0
- taco/core/api_client.py +263 -0
- taco/core/assets.py +81 -0
- taco/core/config_store.py +209 -0
- taco/core/context.py +19 -0
- taco/core/developer_center_client.py +165 -0
- taco/core/errors.py +19 -0
- taco/core/file_lock.py +80 -0
- taco/core/http_headers.py +21 -0
- taco/core/openapi_signer.py +221 -0
- taco/core/output.py +72 -0
- taco/core/profile_manager.py +217 -0
- taco/core/profile_resolver.py +151 -0
- taco/core/secure_file.py +76 -0
- taco/release.py +363 -0
- taco/services/__init__.py +1 -0
- taco/services/agent_service.py +314 -0
- taco/services/app_service.py +153 -0
- taco/services/category_service.py +57 -0
- taco/services/model_service.py +117 -0
- taco/services/tool_service.py +482 -0
- taco/services/workflow_compiler.py +1665 -0
- taco/services/workflow_service.py +652 -0
- taco/services/workflow_tool_service.py +439 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/METADATA +158 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/RECORD +104 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/WHEEL +4 -0
- tinet_agent_cli-0.1.0.dev36.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: taco
|
|
3
|
+
description: Use when creating, configuring, debugging, publishing, or integrating TINET/Dify agents, tools, and workflows through the TACO CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TACO
|
|
7
|
+
|
|
8
|
+
Treat the installed CLI as the source of truth. Do not rely on remembered flags, category codes, model IDs, tool IDs, or payload shapes.
|
|
9
|
+
|
|
10
|
+
## Discovery protocol
|
|
11
|
+
|
|
12
|
+
Before changing platform state:
|
|
13
|
+
|
|
14
|
+
1. Run `taco --json profile list` and use the first row with `current=true` as the default runtime target.
|
|
15
|
+
2. Run `taco help -o json`.
|
|
16
|
+
3. Run `taco agent scenario list -o json`, then `taco agent scenario describe <scenario-id> -o json`.
|
|
17
|
+
4. Run `taco agent schema show <resource> -o json` before editing a DSL.
|
|
18
|
+
5. When the scenario names an example, run `taco agent example describe <example-id> -o json`.
|
|
19
|
+
6. Run category, model, and tool discovery commands required by the scenario.
|
|
20
|
+
|
|
21
|
+
Use `--json --no-input` for business commands. Parse successful data from stdout and errors from stderr. Branch on `error.code`, not translated message text.
|
|
22
|
+
|
|
23
|
+
## AccessKey profile and AIKB flow
|
|
24
|
+
|
|
25
|
+
TACO resolves the Zenava current profile first and falls back to its own current profile. Always use `taco --json profile list` to inspect both sources; current rows are listed first, with Zenava before TACO. To create or update a TACO-owned profile, use `taco profile set --name <profile-name> --endpoint <developer-center-endpoint> --access-key-id <id>` and provide the secret through `TACO_ACCESS_KEY_SECRET` whenever possible. `set` performs no network request. Never print the secret or use a secret-reveal option. Use `profile use` only to change TACO's current profile; pass global `--profile <name>` when an explicit target is required.
|
|
26
|
+
|
|
27
|
+
For AIKB work, first run `taco aikb operation search <intent>` to obtain a small candidate set, then `taco aikb operation describe <operation-id>` before selecting and calling an unfamiliar interface. A known, previously described operation ID may be called directly. Never guess parameter names or types, bypass `--yes`, or invent an operation outside the built-in catalog. `get-file-upload-url` requires `--file` and performs the PUT upload; never expose the returned temporary upload URL. Use the returned `file_key` in a separately approved `create-file` call when needed.
|
|
28
|
+
|
|
29
|
+
These rules apply equally to any AI Agent or human caller; do not branch behavior by Agent product name.
|
|
30
|
+
|
|
31
|
+
## Application template flow
|
|
32
|
+
|
|
33
|
+
Run `taco --json --no-input agent app template list` before choosing a template. Select only an ID returned in `recommended_apps[].app_id`; do not guess a template ID. After showing the selected template and obtaining approval, run `taco --json --no-input agent app template create <template-app-id> --yes`. Omit `--name` to 沿用模板原名称; use `--name <name>` only when the user requests an override. 创建前取得用户批准,不得自动添加 `--yes`。
|
|
34
|
+
|
|
35
|
+
## Agent data OpenAPI flow
|
|
36
|
+
|
|
37
|
+
For conversation history, conversation messages, or message traces, first run `taco agent operation search <intent>` to find candidates, then `taco agent operation describe <operation-id>` before using `taco agent call <operation-id>`. These developer-center APIs require an AccessKey profile; do not substitute a legacy token profile or guess parameters.
|
|
38
|
+
|
|
39
|
+
Pagination is caller-controlled. When `has_more=true`, call again with the returned `next_cursor` and keep every parameter 除 cursor 外 unchanged. Stop when `has_more=false`; do not invent or parse the opaque cursor.
|
|
40
|
+
|
|
41
|
+
## Safety
|
|
42
|
+
|
|
43
|
+
- Never print or write AccessKey secrets, refresh tokens, access tokens, provider credentials, temporary upload URLs, or workflow secrets into a DSL or output.
|
|
44
|
+
- Never guess IDs returned by platform discovery.
|
|
45
|
+
- `--yes` 用于命令写操作确认;在 Agent create、Workflow create、publish、credential、secret、tool 或 install 写入前取得用户批准。
|
|
46
|
+
- `--overwrite` 用于本地文件覆盖,与 `--yes` 语义不同;`agent pull --overwrite` 没有 `--yes`,但覆盖现有 DSL 前仍须单独取得用户批准。
|
|
47
|
+
- Preserve local DSL on validation, debug, API, or publish failure.
|
|
48
|
+
- After successful Agent publish, tell the user whether the DSL was deleted or retained.
|
|
49
|
+
|
|
50
|
+
## Basic Agent flow
|
|
51
|
+
|
|
52
|
+
Use scenario `agent-basic`. Discover category and model, describe the chosen model, then create or pull the Agent DSL. Read `agent schema show agent`, edit only supported fields, validate against the category, run, and publish only after approval.
|
|
53
|
+
|
|
54
|
+
For continued conversations, reuse `conversation_id`. To make stop actionable, run with `--stream-events`, read the early `task_id` NDJSON event, then call `agent stop` from another process.
|
|
55
|
+
|
|
56
|
+
## Builtin tool flow
|
|
57
|
+
|
|
58
|
+
Use scenario `agent-builtin-tool`. Discover the exact Provider and tool, inspect its parameter and credential schemas, and configure workspace credentials only through stdin or environment variables after approval. Never copy Provider credentials or `secret-input` values into a local DSL or shell command. If a secret appears in chat or logs, treat it as compromised and request a rotated value through a secure environment variable.
|
|
59
|
+
|
|
60
|
+
Only discovered `form` parameters belong in the `--parameters` file; LLM parameters are supplied at runtime and Provider credentials use credential management. Attach with `agent tool add`; do not handcraft `agent_mode.tools` or use `--replace` without separate approval. Preserve the existing `pre_prompt` while adding when to call the tool, required inputs, failure behavior, and the rule that tool results must not be invented. Validate and run both a tool-triggering query and a query that should not invoke it; confirm the SSE events show the expected tool behavior before requesting publish approval.
|
|
61
|
+
|
|
62
|
+
## Workflow Tool flow
|
|
63
|
+
|
|
64
|
+
Use scenario `agent-workflow-tool`. Always discover it with `agent scenario describe`, then read `agent schema show workflow` (兼容 `workflow.http`;Chatflow 用 `chatflow`)、`agent schema show agent`、`agent schema show agent-tool`,以及 named examples。Follow the guarded order `validate → dry-run → apply`: validate locally, inspect `agent workflow apply --dry-run`(Chatflow 用 `agent chatflow apply`), request separate approval for apply, set each required secret only with `--from-env` after approval, run(Chatflow 可用 `--query`), request Workflow/Chatflow publish approval, request Tool publish approval, then call `agent workflow tool get` for the real `workflow_tool_id` and name before attaching it to the Agent. Workflow DSL 支持 `http` / `code` / `knowledge-retrieval` / `llm` / `template-transform`,以及 `branch` / `parallel` / `iterate`;Chatflow 终点为 `answer`。
|
|
65
|
+
|
|
66
|
+
Workflow/Agent debug 可能真实触发 HTTP 工具;执行前取得用户批准,并确认所有 HTTP 节点只指向专用非生产 mock/test endpoint,禁止生产客户接口。即使方法为 GET,也按可能产生外部副作用处理。
|
|
67
|
+
|
|
68
|
+
Workflow must be published before Tool publish. Workflow Tool parameters are derived from Workflow Start inputs, and Agent `provider_id` is the discovered `workflow_tool_id`, not the Workflow app ID. Treat `--stream-events` lines as脱敏元数据; only the final envelope contains outputs. 不得猜测 ID,不得自动添加 `--yes`,不得手写 `agent_mode.tools`;use `agent tool add --type workflow` so the CLI resolves the current server contract.
|
taco/cli.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
from typer._click.exceptions import Abort, ClickException, Exit
|
|
5
|
+
|
|
6
|
+
from taco import __version__
|
|
7
|
+
from taco.commands.agent import agent_app
|
|
8
|
+
from taco.commands.aikb import aikb_app
|
|
9
|
+
from taco.commands.discovery import machine_help
|
|
10
|
+
from taco.commands.profile import profile_app
|
|
11
|
+
from taco.core.context import CliContext
|
|
12
|
+
from taco.core.errors import TacoError
|
|
13
|
+
from taco.core.output import failure, to_json_line
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
app = typer.Typer(help="Tinet Agent CLI Orchestrator")
|
|
17
|
+
app.add_typer(agent_app, name="agent")
|
|
18
|
+
app.add_typer(aikb_app, name="aikb")
|
|
19
|
+
app.add_typer(profile_app, name="profile")
|
|
20
|
+
app.command("help", help="以 text 或 JSON 输出当前 CLI 命令契约。")(machine_help)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _version_callback(value: bool) -> None:
|
|
24
|
+
if value:
|
|
25
|
+
typer.echo(__version__)
|
|
26
|
+
raise typer.Exit()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@app.callback()
|
|
30
|
+
def root(
|
|
31
|
+
ctx: typer.Context,
|
|
32
|
+
profile: str | None = typer.Option(
|
|
33
|
+
None,
|
|
34
|
+
"--profile",
|
|
35
|
+
help="使用指定 profile。",
|
|
36
|
+
),
|
|
37
|
+
json_output: bool = typer.Option(
|
|
38
|
+
False,
|
|
39
|
+
"--json",
|
|
40
|
+
help="输出机器可读 JSON。",
|
|
41
|
+
),
|
|
42
|
+
no_input: bool = typer.Option(
|
|
43
|
+
False,
|
|
44
|
+
"--no-input",
|
|
45
|
+
help="禁用交互输入,便于 Agent 或 CI 调用。",
|
|
46
|
+
),
|
|
47
|
+
version: bool = typer.Option(
|
|
48
|
+
False,
|
|
49
|
+
"--version",
|
|
50
|
+
help="显示当前版本号",
|
|
51
|
+
callback=_version_callback,
|
|
52
|
+
is_eager=True,
|
|
53
|
+
),
|
|
54
|
+
) -> None:
|
|
55
|
+
ctx.obj = CliContext(
|
|
56
|
+
profile=profile,
|
|
57
|
+
json_output=json_output,
|
|
58
|
+
no_input=no_input,
|
|
59
|
+
)
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def main() -> None:
|
|
64
|
+
try:
|
|
65
|
+
result = app(
|
|
66
|
+
args=_without_ignored_compat_args(sys.argv[1:]),
|
|
67
|
+
standalone_mode=False,
|
|
68
|
+
prog_name="taco",
|
|
69
|
+
)
|
|
70
|
+
if isinstance(result, int) and result != 0:
|
|
71
|
+
raise SystemExit(result)
|
|
72
|
+
except Exit as error:
|
|
73
|
+
raise SystemExit(error.exit_code) from None
|
|
74
|
+
except Abort:
|
|
75
|
+
_exit_main_with_error(
|
|
76
|
+
TacoError(
|
|
77
|
+
code="CLI_ABORTED",
|
|
78
|
+
message="命令已中止。",
|
|
79
|
+
exit_code=130,
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
except ClickException:
|
|
83
|
+
_exit_main_with_error(
|
|
84
|
+
TacoError(
|
|
85
|
+
code="CLI_USAGE_ERROR",
|
|
86
|
+
message="命令参数不合法。",
|
|
87
|
+
exit_code=2,
|
|
88
|
+
hint="请执行 taco help -o json 查看当前命令契约。",
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
except TacoError as error:
|
|
92
|
+
_exit_main_with_error(error)
|
|
93
|
+
except Exception:
|
|
94
|
+
_exit_main_with_error(
|
|
95
|
+
TacoError(
|
|
96
|
+
code="UNEXPECTED_ERROR",
|
|
97
|
+
message="命令执行时发生未预期错误。",
|
|
98
|
+
exit_code=1,
|
|
99
|
+
hint="请在不包含凭据的前提下提交复现步骤。",
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _without_ignored_compat_args(args: list[str]) -> list[str]:
|
|
105
|
+
filtered: list[str] = []
|
|
106
|
+
index = 0
|
|
107
|
+
while index < len(args):
|
|
108
|
+
argument = args[index]
|
|
109
|
+
if argument == "--from-zenava":
|
|
110
|
+
index += 1
|
|
111
|
+
if index < len(args) and args[index].lower() in {"true", "false"}:
|
|
112
|
+
index += 1
|
|
113
|
+
continue
|
|
114
|
+
if argument.startswith("--from-zenava="):
|
|
115
|
+
index += 1
|
|
116
|
+
continue
|
|
117
|
+
filtered.append(argument)
|
|
118
|
+
index += 1
|
|
119
|
+
return filtered
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _exit_main_with_error(error: TacoError) -> None:
|
|
123
|
+
if "--json" in sys.argv:
|
|
124
|
+
typer.echo(to_json_line(failure(error)), err=True)
|
|
125
|
+
else:
|
|
126
|
+
typer.echo(f"{error.code}: {error.message}", err=True)
|
|
127
|
+
raise SystemExit(error.exit_code)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Command modules for TACO."""
|